Hrvoje Abraham added the comment:

Regarding NaN sign bit, IEEE-754 states:

"Note, however, that operations on bit strings—copy, negate, abs, 
copySign—specify the sign bit of a NaN result, sometimes based upon the sign 
bit of a NaN operand. The logical predicate totalOrder is also affected by the 
sign bit of a NaN operand."

So NaN sign bit information is used in the standard itself (section 5.10.d):

1) totalOrder(−NaN, y) is true where −NaN represents a NaN with negative sign 
bit and y is a
   floating-point number.
2) totalOrder(x, +NaN) is true where +NaN represents a NaN with positive sign 
bit and x is a
   floating-point number.

This fact alone implies the importance of its round-trip safety. I believe the 
quote you picked states this information doesn't have universal (standardized) 
meaning, not it is not important or used at all. It is reasonable to assume 
some will need to preserve it.

There are also some real-life usages, similar as signed zero, in determining 
the correct complex plane branch cut:
http://stackoverflow.com/questions/8781072/sign-check-for-nan-value
http://docstore.mik.ua/manuals/hp-ux/en/B2355-60130/catan.3M.html
catan(inf + iNAN) => π/2 + i0; catan(inf - iNAN) => π/2 - i0;

MSVC 2015 and MinGW-W64 v4.9.2 output (source below) for '-nan' values are:

MSVC:      -nan(ind)
MinGW-W64: -1.#IND00


#include <stdio.h>

int main()
{
    double x = 0.0;
    x = - x / x;
    printf("%lf\n", x);

    return 0;
}

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26785>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to