[
https://issues.apache.org/jira/browse/STDCXX-797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12582067#action_12582067
]
Martin Sebor commented on STDCXX-797:
-------------------------------------
The bit pattern for the special floating point numbers {{NaN}} and {{Infinity}}
is computed in
[INFINITY.cpp|http://svn.apache.org/repos/asf/stdcxx/trunk/etc/config/src/INFINITY.cpp]
To compute {{NaN}} the test evaluates the expression {{(0 / 0)}} from the
table below, which is expected to yield a positive {{NaN}}. For some reason, on
HP-UX/IPF (as well as Linux/x86_64) the sign of the result is negative,
regardless of the sign of the operands of the expression. On AIX/Power and
Solaris/SPARC, the sign is positive, also irrespective of the sign of the
operands.
||Operation||Result||
|n ÷ ±Inf|0|
|±Inf × ±Inf|±Inf|
|±nonzero ÷ 0|±Inf|
|Inf + Inf|Inf|
|±0 ÷ ±0|NaN|
|Inf - Inf|NaN|
|±Inf ÷ ±Inf|NaN|
|±Inf × 0|NaN|
> [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
>
> Original Estimate: 2h
> Remaining Estimate: 2h
>
> 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.