[Python-ideas] Suggestion: Extend integers to include iNaN

David Mertz mertz at gnosis.cx
Sun Sep 30 11:13:19 EDT 2018


On Sun, Sep 30, 2018 at 11:01 AM Steve Barnes <gadgetsteve at live.co.uk>
wrote:

> Adding inf & -inf would be nice but to do so we would need a better name
> than NaNAwareInt.
>

My placeholder name is deliberately awkward.  I think it gestures at the
concept for discussion purposes though.


> It would also be nice if Decimal(NaNAwareInt('nan')) = Decimal('NaN'),
> float(NaNAwareInt('nan')) = float('nan'), etc.


This seems like bad behavior given (per IEEE-754 spec):

>>> float('nan') == float('nan')
False
>>> nan = float('nan')
>>> nan == nan
False


-- 
Keeping medicines from the bloodstreams of the sick; food
from the bellies of the hungry; books from the hands of the
uneducated; technology from the underdeveloped; and putting
advocates of freedom in prisons.  Intellectual property is
to the 21st century what the slave trade was to the 16th.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180930/802824a5/attachment.html>


More information about the Python-ideas mailing list