C++ Standard Library
  1. C++ Standard Library
  2. STDCXX-51

infinity, NaN formatted differently on different platforms

    Details

    • Type: Improvement Improvement
    • Status: Reopened
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 4.1.2, 4.1.3, 4.1.4, 4.2.0, 4.2.1
    • Fix Version/s: 4.2.2
    • Component/s: 22. Localization
    • Labels:
      None
    • Environment:

      all

    • Patch Info:
      Patch Available
    • Severity:
      Incorrect Behavior

      Description

      The output of the program below is different depending on the operating system it runs on. It should be the same (preferably like that on AIX).

      $ cat u.cpp && uname -sr && make u -r && ./u
      #include <iostream>
      #include <limits>
      
      int main ()
      {
          std::cout << std::numeric_limits<double>::infinity () << '\n'
                    << std::numeric_limits<double>::quiet_NaN () << '\n'
                    << std::numeric_limits<double>::signaling_NaN () << '\n'; 
      }
      SunOS 5.9
      gcc -c -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG   -pthreads -D_RWSTD_USE_CONFIG -I/build/sebor/gcc-3.4.3-15s/include -I/build/sebor/dev/stdlib/include -I/build/sebor/dev/stdlib/examples/include  -pedantic -nostdinc++ -g  -Wall -W -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long  u.cpp
      gcc u.o -o u -pthreads -L/build/sebor/gcc-3.4.3-15s/lib -lstd15s  -lsupc++ -lm
      rm u.o
      inf
      nan
      nan
      
      $ uname -vs && gmake u -r && ./u
      AIX 5
      xlCcore_r -c -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG    -D_RWSTD_USE_CONFIG -I/build/sebor/vacpp-7.0.0.3-15D/include -I/build/sebor/dev/stdlib/include -I/build/sebor/dev/stdlib/examples/include  -g  -q64  -qtemplateregistry=u.ti   u.cpp
      xlCcore_r u.o -o u -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG    -D_RWSTD_USE_CONFIG -liconv -brtl   -q64 -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG    -D_RWSTD_USE_CONFIG -I/build/sebor/vacpp-7.0.0.3-15D/include -I/build/sebor/dev/stdlib/include -I/build/sebor/dev/stdlib/examples/include  -qtemplateregistry=u.ti -L/build/sebor/vacpp-7.0.0.3-15D/lib -lstd15D   -lm
      rm u.o
      inf
      nanq
      nans
      
      1. num_put.diff
        10 kB
        Farid Zaripov

        Issue Links

          Activity

          Gavin made changes -
          Link This issue is depended upon by STDCXX-458 [ STDCXX-458 ]
          Gavin made changes -
          Link This issue blocks STDCXX-458 [ STDCXX-458 ]
          Martin Sebor made changes -
          Remaining Estimate 0h [ 0 ] 8h [ 28800 ]
          Martin Sebor made changes -
          Affects Version/s 4.2.1 [ 12312690 ]
          Severity Incorrect Behavior
          Fix Version/s 4.2.2 [ 12313096 ]
          Fix Version/s 4.2.1 [ 12312690 ]
          Martin Sebor made changes -
          Status Closed [ 6 ] Reopened [ 4 ]
          Resolution Fixed [ 1 ]
          Assignee Farid Zaripov [ farid ] Martin Sebor [ sebor ]
          Farid Zaripov made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Farid Zaripov made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Farid Zaripov made changes -
          Description The output of the program below is different depending on the operating system it runs on. It should be the same (preferably like that on AIX).

          $ cat u.cpp && uname -sr && make u -r && ./u
          #include <iostream>
          #include <limits>

          int main ()
          {
              std::cout << std::numeric_limits<double>::infinity () << '\n'
                        << std::numeric_limits<double>::quiet_NaN () << '\n'
                        << std::numeric_limits<double>::signaling_NaN () << '\n';
          }
          SunOS 5.9
          gcc -c -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG -pthreads -D_RWSTD_USE_CONFIG -I/build/sebor/gcc-3.4.3-15s/include -I/build/sebor/dev/stdlib/include -I/build/sebor/dev/stdlib/examples/include -pedantic -nostdinc++ -g -Wall -W -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long u.cpp
          gcc u.o -o u -pthreads -L/build/sebor/gcc-3.4.3-15s/lib -lstd15s -lsupc++ -lm
          rm u.o
          inf
          nan
          nan

          $ uname -vs && gmake u -r && ./u
          AIX 5
          xlCcore_r -c -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG -D_RWSTD_USE_CONFIG -I/build/sebor/vacpp-7.0.0.3-15D/include -I/build/sebor/dev/stdlib/include -I/build/sebor/dev/stdlib/examples/include -g -q64 -qtemplateregistry=u.ti u.cpp
          xlCcore_r u.o -o u -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG -D_RWSTD_USE_CONFIG -liconv -brtl -q64 -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG -D_RWSTD_USE_CONFIG -I/build/sebor/vacpp-7.0.0.3-15D/include -I/build/sebor/dev/stdlib/include -I/build/sebor/dev/stdlib/examples/include -qtemplateregistry=u.ti -L/build/sebor/vacpp-7.0.0.3-15D/lib -lstd15D -lm
          rm u.o
          inf
          nanq
          nans
          The output of the program below is different depending on the operating system it runs on. It should be the same (preferably like that on AIX).

          {noformat}
          $ cat u.cpp && uname -sr && make u -r && ./u
          #include <iostream>
          #include <limits>

          int main ()
          {
              std::cout << std::numeric_limits<double>::infinity () << '\n'
                        << std::numeric_limits<double>::quiet_NaN () << '\n'
                        << std::numeric_limits<double>::signaling_NaN () << '\n';
          }
          SunOS 5.9
          gcc -c -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG -pthreads -D_RWSTD_USE_CONFIG -I/build/sebor/gcc-3.4.3-15s/include -I/build/sebor/dev/stdlib/include -I/build/sebor/dev/stdlib/examples/include -pedantic -nostdinc++ -g -Wall -W -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long u.cpp
          gcc u.o -o u -pthreads -L/build/sebor/gcc-3.4.3-15s/lib -lstd15s -lsupc++ -lm
          rm u.o
          inf
          nan
          nan

          $ uname -vs && gmake u -r && ./u
          AIX 5
          xlCcore_r -c -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG -D_RWSTD_USE_CONFIG -I/build/sebor/vacpp-7.0.0.3-15D/include -I/build/sebor/dev/stdlib/include -I/build/sebor/dev/stdlib/examples/include -g -q64 -qtemplateregistry=u.ti u.cpp
          xlCcore_r u.o -o u -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG -D_RWSTD_USE_CONFIG -liconv -brtl -q64 -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG -D_RWSTD_USE_CONFIG -I/build/sebor/vacpp-7.0.0.3-15D/include -I/build/sebor/dev/stdlib/include -I/build/sebor/dev/stdlib/examples/include -qtemplateregistry=u.ti -L/build/sebor/vacpp-7.0.0.3-15D/lib -lstd15D -lm
          rm u.o
          inf
          nanq
          nans
          {noformat}
          Farid Zaripov made changes -
          Remaining Estimate 13h [ 46800 ] 0h [ 0 ]
          Time Spent 13h [ 46800 ]
          Farid Zaripov made changes -
          Remaining Estimate 13h [ 46800 ]
          Original Estimate 13h [ 46800 ]
          Farid Zaripov made changes -
          Affects Version/s 4.1.3 [ 12310191 ]
          Affects Version/s 4.2.0 [ 12311945 ]
          Fix Version/s 4.2.1 [ 12312690 ]
          Affects Version/s 4.1.4 [ 12310693 ]
          Farid Zaripov made changes -
          Patch Info [Patch Available]
          Farid Zaripov made changes -
          Attachment num_put.diff [ 12379051 ]
          Farid Zaripov made changes -
          Link This issue relates to STDCXX-819 [ STDCXX-819 ]
          Farid Zaripov made changes -
          Assignee Farid Zaripov [ farid ]
          Martin Sebor made changes -
          Link This issue relates to STDCXX-2 [ STDCXX-2 ]
          Martin Sebor made changes -
          Link This issue relates to STDCXX-464 [ STDCXX-464 ]
          Farid Zaripov made changes -
          Field Original Value New Value
          Link This issue blocks STDCXX-458 [ STDCXX-458 ]
          Martin Sebor created issue -

            People

            • Assignee:
              Martin Sebor
              Reporter:
              Martin Sebor
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:

                Time Tracking

                Estimated:
                Original Estimate - 13h Original Estimate - 13h
                13h
                Remaining:
                Time Spent - 13h Remaining Estimate - 8h
                8h
                Logged:
                Time Spent - 13h Remaining Estimate - 8h
                13h

                  Development