Uploaded image for project: 'C++ Standard Library'
  1. C++ Standard Library
  2. STDCXX-797

[HP-UX/IPF] NaN has the wrong sign

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 4.2.0
    • Fix Version/s: 4.2.2
    • Component/s: 18. Language Support
    • Labels:
      None
    • Environment:

      HP-UX B.11.31
      aCC: HP C/aC++ B3910B A.06.16 [Nov 26 2007]

    • Severity:
      Incorrect Behavior

      Description

      On HP-UX/IPF, std::numeric_limits<T>::quiet_NaN() has the wrong sign for all floating point types T:

      $ cat t.cpp && uname -sr && aCC -V && aCC -AA t.cpp && ./a.out && gmake t && ./t
      #include <cassert>
      #include <cmath>
      #include <limits>
      
      template <class T>
      void test (T x, T expect)
      {
          assert (fpclassify (x) == fpclassify (expect));
          assert (signbit (x) == signbit (expect));
      }
      
      int main ()
      {
          test (std::numeric_limits<float>::quiet_NaN (), float (NAN));
          test (-std::numeric_limits<float>::quiet_NaN (), -float (NAN));
      
          test (std::numeric_limits<double>::quiet_NaN (), double (NAN));
          test (-std::numeric_limits<double>::quiet_NaN (), -double (NAN));
      
          test (std::numeric_limits<long double>::quiet_NaN (), (long double)NAN);
          test (-std::numeric_limits<long double>::quiet_NaN (), -(long double)NAN);
      }
      HP-UX B.11.31
      aCC: HP C/aC++ B3910B A.06.16 [Nov 26 2007]
      aCC -c  -D_RWSTDDEBUG   -mt -I/amd/devco/sebor/stdcxx/include -I/build/sebor/stdcxx-aCC-6.16-15D/include \
          -I/amd/devco/sebor/stdcxx/examples/include  -AA  -g +d  +DD64 +w \
          +W392 +W655 +W684 +W818 +W819 +W849 +W2193 +W2236 +W2261 +W2340 +W2401 +W2487 +W4227 +W4229 \
          +W4231 +W4235 +W4237 +W4249 +W4255 +W4272 +W4284 +W4285 +W4286 +W4296 +W4297 +W3348   t.cpp
      "/amd/devco/sebor/stdcxx/include/limits", line 449: warning #4070-D: floating
                point underflow exception
            _RWSTD_STATIC_FUN (long double, (min), _RWSTD_LDBL_MIN) 
            ^
      
      aCC t.o -o t -AA +nostl -Wl,+s   -mt +DD64 -L/build/sebor/stdcxx-aCC-6.16-15D/lib  -Wl,+b/build/sebor/stdcxx-aCC-6.16-15D/lib -lstd15D  -lm 
      Assertion failed: signbit (x) == signbit (expect), file t.cpp, line 9
      ABORT instruction (core dumped)
      

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:

                  Time Tracking

                  Estimated:
                  Original Estimate - 2h
                  2h
                  Remaining:
                  Remaining Estimate - 2h
                  2h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified