+ 2

# NAN and -INFINITY

#include <iostream> #include <cmath> int main() { std::cout << fmax(NAN, -INFINITY); } // Output is "-inf" But how? -inf is the smallest number :))) so everything will be larger than "-inf" Also, cout << fmin(INFINITY, NAN); // inf is output But inf is the biggest number :))))))))))) I think they should fix this in new versions of c++ ;) if there's a new version

1 Answer

+ 6

fmax = Returns the larger of two floating point arguments, treating "NaNs as missing data".
(Between a NaN and a numeric value, the numeric value is chosen).
So, -inf is the only data in fmax and hence gets return.