Below control of bigger than 0.0 for a double variable works correctly. I am curious about whether the compiled exe with this function could behave differently on different systems.
bool MyFunction(double x)
{
if (x > 0.0)
return true;
else
return false;
}
I mean do the below lines of main()
behave differently on different systems?
double x = 0.0;
cout << MyFunction(x);
While the C++ standard doesn't specify how floating point are represented, I doubt that there are any representations used in practice that cannot represent 0.0 precisely. It is safe to assume that the function returns false.