+ 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

13th May 2021, 8:16 AM
Mani_K_A
1 Respuesta
+ 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.
13th May 2021, 8:39 AM
minirkk
minirkk - avatar