I noticed a difference in the floating point values represented for Infinity and NAN. Is this specified some where in the standard?
#include <cmath>
#include <iostream>
#include <limits>
#include <stdint.h>
union Double
{
double value;
uint64_t repr;
};
int main()
{
Double d;
d.value = std::numeric_limits<double>::infinity();
std::cout << std::hex << "inf: " << d.repr << std::endl;
d.value = std::numeric_limits<double>::quiet_NaN();
std::cout << std::hex << "NAN: " << d.repr << std::endl;
return 0;
}
Ouput:
inf: 0x7ff0000000000000
NAN: 0x7ff8000000000000