[HP-UX/IPF] NaN has the wrong sign
----------------------------------
Key: STDCXX-797
URL: https://issues.apache.org/jira/browse/STDCXX-797
Project: C++ Standard Library
Issue Type: Bug
Components: 18. Language Support
Affects Versions: 4.2.0
Environment: HP-UX B.11.31
aCC: HP C/aC++ B3910B A.06.16 [Nov 26 2007]
Reporter: Martin Sebor
Priority: Minor
Fix For: 4.2.1
On HP-UX/IPF, {{std::numeric_limits<T>::quiet_NaN()}} has the wrong sign for
all floating point types {{T}}:
{noformat}
$ 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)
{noformat}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.