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

Hrvoje Abraham report at bugs.python.org
Sat Apr 16 14:44:53 EDT 2016

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 IEEE-754 2008 standard.

>>> from math import copysign
>>> x = float("-nan")
>>> copysign(1.0, x)

This is correct. Also proves the value contains the sign information.

>>> repr(x)

Not correct. Should be '-nan'.

components: Interpreter Core
messages: 263576
nosy: ahrvoje
priority: normal
severity: normal
status: open
title: repr of -nan value should contain the sign
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list