Inexact representation cases (Re: Against PEP 240)

Michael Hudson mwh at python.net
Sun Jun 3 17:16:55 EDT 2001


"Tim Peters" <tim.one at home.com> writes:

> It turns out that the closest you can get in IEEE double is
> 
>     1.1 ~= 2476979795053773 / 2**51
> 
> which is, as a *decimal* number, *exactly*
> 
>     1.100000000000000088817841970012523233890533447265625

How did you get these numbers?  I'm sure you posted the routine a week
or so back, but I can't dig it out of google.

I want to write a sys.displayhook that prints floats exactly, just for
extra geekiness value.

Cheers,
M.

-- 
  If you have too much free time and can't think of a better way to
  spend it than reading Slashdot, you need a hobby, a job, or both.
     -- http://www.cs.washington.edu/homes/klee/misc/slashdot.html#faq



More information about the Python-list mailing list