Exact integer-valued floats
Paul Rubin
no.email at nospam.invalid
Fri Sep 21 18:23:41 EDT 2012
Steven D'Aprano <steve+comp.lang.python at pearwood.info> writes:
> Have I got this right? Is there a way to work out the gap between one
> float and the next?
Yes, 53-bit mantissa as people have mentioned. That tells you what ints
can be exactly represented. But, arithmetic in some situations can have
a 1-ulp error. So I wonder if it's possible that if n is large enough,
you might have something like n+1==n even if the integers n and n+1 have
distinct floating point representations.
More information about the Python-list
mailing list