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;

           Summary: Same binary prints sign of nan on different systems.
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: j dot s4403 at gmail dot com


Reply via email to