Inexact representation cases (Re: Against PEP 240)
Aahz Maruch
aahz at panix.com
Sun Jun 3 18:05:47 EDT 2001
In article <m3ae3pb6wo.fsf at atrus.jesus.cam.ac.uk>,
Michael Hudson <mwh at python.net> wrote:
>"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.
You can use Decimal.py (with its associated bugs) from
http://starship.python.net/crew/aahz/
--
--- Aahz <*> (Copyright 2001 by aahz at pobox.com)
Androgynous poly kinky vanilla queer het Pythonista http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6
I surf faster than you do, monkey boy. (My take on Netscape vs. Lynx)
More information about the Python-list
mailing list