[Tutor] float.is_integer()

Alan Gauld alan.gauld at yahoo.co.uk
Fri Oct 2 19:17:33 EDT 2020


On 02/10/2020 18:07, Manprit Singh wrote:

>>>> (23444444444444444.7777).is_integer()
> True

How weird. I get the same result and the documentation is so
sparse that it's of no real help.

Hopefully somebody else can shed some light on it.
Or maybe you've actually found a bug! But I suspect the answer
will lie in one of those odd binary level features of floats...
But too subtle for me!

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list