Due to a change in glibc, an identical binary compiled with g++ 4.3 and run on different systems prints a different result for nan. In the program at the end of the report, a x86_64 binary run on an Ubuntu 10.04.1 LTS prints "-nan" while the same exact binary run on Ubuntu 8.04.4 LTS prints "nan". In an article on stackoverflow.com, someone found that a change on 2009-08-23 in glibc printf routine is the reason for this: * stdio-common/printf_fp.c: ISO C expects to print the sign of NaN as well. Is there a standard for c++ as to how the iostreams should format a nan? using namespace std; int main() { cout << 0./0. << endl; }
It should be the same as C (as if done by printf) and our implementation relies on the C library to do it correctly
Therefore the glibc fix is required to get the correct output.