[Tutor] float.is_integer()

Manprit Singh manpritsinghece at gmail.com
Fri Oct 2 13:07:53 EDT 2020


Dear Sir,

Kindly look at the below experiment done on python IDLE Shell :


>>> (2.0).is_integer()
True
>>> (2.4).is_integer()
False
>>> (234.77777777777777).is_integer()
False
>>> (23444444444444444.7777).is_integer()
True
>>> (234444444444444.73).is_integer()
False
>>> (23444444444444444444444.73).is_integer()
True

Just need to know why the 4th and 6th lines return True, It should be
False. Is
there any limitation on using this float.is_integer() method ?

Regards
Manprit singh


More information about the Tutor mailing list