[Tutor] float.is_integer()

Richard Damon Richard at Damon-Family.org
Sat Oct 3 08:53:49 EDT 2020


On 10/3/20 5:51 AM, Alan Gauld via Tutor wrote:
> On 03/10/2020 01:08, Zachary Ware wrote:
>> Have a look at the repr of 23444444444444444.7777; a 64 bit floating point
>> number cannot represent that number exactly.
> So basically the float is just too big to include the fractional part.
> Hmm, I wonder where the break off point is? Time to do some math...
> Or play with the interpreter! :-)
>
Python floating point numbers have 52 significant bits + implied leading
1 + sign bit. Numbers less than 2^52 have fractional bits, 2^52 and
bigger can not.

-- 
Richard Damon



More information about the Tutor mailing list