Bug: (Locale) IDLE/Tkinter/Python?
Tim Peters
tim_one at email.msn.com
Fri Oct 8 01:13:42 EDT 1999
FYI,
> ...
> but (a) it's painful to write your own atof(), %e, %f, %g formatter
> in a platform independent manner with the best accuracy,
That's for sure.
> (b) it seems such a waste of effort since the C library has one,
No, it doesn't. Very few libcs do floating-point I or O with best accuracy
(Sun does -- and offhand I don't know of anyone else!), which means Python's
FP I/O is as platform-dependent as C's. It's such a subtle problem that the
IEEE-754 std doesn't demand proper rounding for float<->string conversion,
despite that it demands it for everything else. These days that's widely
considered to be a bug in the std.
David Gay wrote excruciating "proper" FP conversion code, available from
NETLIB. Ten dollars to the first person who can prove it correct <wink>.
It's actually easy to get this right, provided you don't care how slow it
runs (if you're willing to fake thousand-bit integers, it's a snap).
floats-are-really-large-rationals-ly y'rs - tim
More information about the Python-list
mailing list