Strange rounding problem

Steven Taschuk staschuk at telusplanet.net
Sun Mar 16 15:47:54 EST 2003


Quoth Dan Bishop:
> Steven Taschuk <staschuk at telusplanet.net> wrote in message news:<mailman.1047761005.17660.python-list at python.org>...
  [...]
> >     x = 1.000000011011001010110010100110100100011010010010101101100e-20
> >     y = 1.000000011011001010110010100110100100011010010010101011111e-20
> > These values first differ at the 53rd significant bit, here: ^.
> > [Distinguishing these is] *just* within the capacity of IEEE 754
> > double-precision floats, I think.
> 
> Normalized IEEE double has 53 bits of precision (including the
> implicit leading 1), so you would be right if it weren't for the fact
> that both values get rounded to
> 1.0000000110110010101100101001101001000110100100101011e-20.

Ah, yes, of course.  So, we'd need 54 bits, as it happens.

Thanks for the correction.

-- 
Steven Taschuk                          staschuk at telusplanet.net
"Its force is immeasurable.  Even Computer cannot determine it."
                           -- _Space: 1999_ episode "Black Sun"





More information about the Python-list mailing list