Paul Hoffman added the comment:

Mark:

>I don't see how math.isnan or math.isinf would be affected: we're not 
>proposing to make a float16 Python type, so math.isnan would never encounter a 
>float16 value.

I was assuming that this proposal would also make this part of class 'float' 
just like the other floats returned from struct. Otherwise, you will get goofy 
cases where someone has to special-case what they get from struct.

import math, struct
FullInfinityAsInt = 0x7f800000
ThisFloat = (struct.unpack("f", struct.pack("I", FullInfinityAsInt)))[0]
print("The type is " + str(type(ThisFloat)))
if math.isinf(ThisFloat):
        print("This is an infiniity")
else:
        print("This is not an infinity")

This should work similarly for the new half-precision, I would think.

----------

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

Reply via email to