Can "bigger than 0.0" control show different behaviors on different systems?

77 views Asked by At

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);
1

There are 1 answers

4
eerorika On BEST ANSWER

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.