[issue26785] repr of -nan value should contain the sign

2016-04-19 Thread Mark Dickinson
Mark Dickinson added the comment: The sign of a NaN *is* fully supported, and easily accessible to those who need it. It just isn't part of the repr. Given that the sign is meaningless in the vast majority of applications, I think Python does the right thing here by leaving it out of the

[issue26785] repr of -nan value should contain the sign

2016-04-18 Thread Hrvoje Abraham
Hrvoje Abraham added the comment: IEEE & C/C++ standards allow and explicitly mention it, some people and projects are using it, many compilers preserve it... I believe it's reasonable to support it despite the fact it does not have standardized semantic meaning. Maybe one day... --

[issue26785] repr of -nan value should contain the sign

2016-04-18 Thread Mark Dickinson
Mark Dickinson added the comment: This StackOverflow answer from one of the IEEE 754 committee members is highly relevant here: http://stackoverflow.com/a/21350299/270986 -- ___ Python tracker

[issue26785] repr of -nan value should contain the sign

2016-04-18 Thread Mark Dickinson
Changes by Mark Dickinson : -- type: behavior -> enhancement ___ Python tracker ___ ___

[issue26785] repr of -nan value should contain the sign

2016-04-18 Thread Mark Dickinson
Mark Dickinson added the comment: > Looks like the sign bit is off (0) in 2.7. Yep, that looks like issue 22590. It's "fixed" in Python 3, and I don't think it's worth changing in Python 2. About this issue (sign in repr of NaN): sorry, but I'm unconvinced. :-) >From the standpoint of IEEE

[issue26785] repr of -nan value should contain the sign

2016-04-17 Thread Hrvoje Abraham
Hrvoje Abraham added the comment: Sage: http://doc.sagemath.org/html/en/reference/rings_numerical/sage/rings/complex_number.html >>> log(ComplexNumber(NaN,1)) NaN - NaN*I -- ___ Python tracker

[issue26785] repr of -nan value should contain the sign

2016-04-17 Thread Hrvoje Abraham
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

[issue26785] repr of -nan value should contain the sign

2016-04-17 Thread Hrvoje Abraham
Hrvoje Abraham added the comment: Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:40:30) [MSC v.1500 64 bit (AMD64)] on win32: >>> import struct >>> x=float("-nan") >>> struct.pack('

[issue26785] repr of -nan value should contain the sign

2016-04-17 Thread Mark Dickinson
Mark Dickinson added the comment: Gah, sorry. I misdiagnosed the Python 2.7 issue (I was looking at the code for the wrong branch). See issue 22590 for the correct diagnosis. -- ___ Python tracker

[issue26785] repr of -nan value should contain the sign

2016-04-17 Thread Mark Dickinson
Mark Dickinson added the comment: About the Python 2.7 behaviour: >>> from math import copysign >>> x = float("-nan") >>> copysign(1.0, x) 1.0 I'd be interested to know what `struct.pack('

[issue26785] repr of -nan value should contain the sign

2016-04-17 Thread Mark Dickinson
Mark Dickinson added the comment: > it is actually used in real-life situations Do you have any examples available? -- ___ Python tracker ___

[issue26785] repr of -nan value should contain the sign

2016-04-17 Thread Mark Dickinson
Mark Dickinson added the comment: The current behaviour is deliberate, so any change would be an enhancement rather than a bugfix. I'm modifying the versions accordingly. Unlike the sign of a zero, the sign of a NaN has no useful meaning: IEEE 754 explicitly says "this standard does not

[issue26785] repr of -nan value should contain the sign

2016-04-16 Thread Eric V. Smith
Eric V. Smith added the comment: Changing versions. I left in 2.7, but I doubt we'd make any changes to 2.7 with regards to this. -- versions: -Python 3.2, Python 3.3 ___ Python tracker

[issue26785] repr of -nan value should contain the sign

2016-04-16 Thread Eric V. Smith
Changes by Eric V. Smith : -- nosy: +eric.smith ___ Python tracker ___ ___

[issue26785] repr of -nan value should contain the sign

2016-04-16 Thread Hrvoje Abraham
Hrvoje Abraham added the comment: Reported issue was created in 64-bit Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:54:25) [MSC v.1900 64 bit (AMD64)] on win32. Now I noticed that in Py 2.7 even copysign part does not work as expected. Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015,

[issue26785] repr of -nan value should contain the sign

2016-04-16 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +mark.dickinson ___ Python tracker ___ ___

[issue26785] repr of -nan value should contain the sign

2016-04-16 Thread Hrvoje Abraham
New submission from Hrvoje Abraham: repr of -nan value should contain the sign so the round-trip could be assured. NaN value sign (bit) could be seen as not relevant or even uninterpretable information, but it is actually used in real-life situations, the fact substantiated by section 6.3 of