[Python-Dev] Expert floats

Tim Peters tim.one at comcast.net
Tue Mar 30 20:22:46 EST 2004


[Andrew Koenig]
> You argued against applying the Scheme rules because that would make
> marshalling less accurate when the unmarshalling is done on a machine
> with longer floats.

I said the 754 committee had that objection.  This was discussed on David
Hough's numeric-interest mailing list at the time Clinger and Steele/White
published their float<->string papers, and "phooey" was the consensus of the
754 folks on the mailing list at the time.  The current incarnation of that
committee appears to be in favor of perfect rounding all the time (so was
the older incarnation, but it wasn't believed to be practical then), but I
don't know what they think about shortest-possible (the older incarnation
disliked that one).

I personally don't think decimal strings are a sane way to transport binary
floats regardless of rounding gimmicks.

> But on such a machine, 17 digits won't be good enough anyway.

Doesn't change that 17 digits gets closer then shortest-possible:  the art
of binary fp is about reducing error, not generally about eliminating error.
Shortest-possible does go against the spirit of 754 in that respect.

>>> I thought that 754 requires input and output to be no more than 0.47
>>> LSB away from exact.

>> No
...
>> - for nearest/even rounding, it requires no more than 0.47 ULP error
>>   *beyond* that allowed for perfect nearest/even conversion (which
>>   has a max error of 0.5 ULP on its own)

> That's what I meant.  Rather than 0.47 from exact, I meant 0.47 from
> the best possible.

Well, you originally said that in response to my saying that the standard
doesn't require perfect rounding (and it doesn't), and that the standard has
different accuracy requirements for different inputs (and it does).  So now
I'm left wondering what your original "I thought that ..." was trying to get
across.

...

> Hey, I know some people who write C programs that don't rely on the
> platform C libraries for anything :-)

Python would love to grab their I/O implementation then <0.8 wink>.




More information about the Python-Dev mailing list