This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author paulehoffman
Recipients Eli.Stevens, asvetlov, belopolsky, mark.dickinson, mark.wiebe, paulehoffman, pitrou
Date 2013-04-23.16:23:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1366734232.47.0.218156352478.issue11734@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2013-04-23 16:23:52paulehoffmansetrecipients: + paulehoffman, mark.dickinson, belopolsky, pitrou, asvetlov, Eli.Stevens, mark.wiebe
2013-04-23 16:23:52paulehoffmansetmessageid: <1366734232.47.0.218156352478.issue11734@psf.upfronthosting.co.za>
2013-04-23 16:23:52paulehoffmanlinkissue11734 messages
2013-04-23 16:23:52paulehoffmancreate