I have the following program:
#include <iostream>
#include <cmath>
int main() {
double a = 1;
double b = nan("");
std::cout << (a > b) << std::endl;
std::cout << (b > a) << std::endl;
return 0;
}
Output:
0
0
In general from the meaning of nan
- not a number
it is clear that any operation with nan
is essentially pointless. From IEEE-754
that I found in internet I found what if in FPU at least one of operands is nan
the result is also nan
, but I found nothing about comparison between normal value and nan
as in example above.
What does standard say about it?
Aucun commentaire:
Enregistrer un commentaire