Rounding Bug in Python 2.0! - ugh
Pete Forman
gsez020 at kryten.bedford.waii.com
Fri Nov 3 04:39:43 EST 2000
hzhu at users.sourceforge.net (Huaiyu Zhu) writes:
> On 01 Nov 2000 14:39:05 +0000, Pete Forman <gsez020 at kryten.bedford.waii.com>
> wrote:
> >
> >It would be nice if Python would make use of dtoa() rather than
> >stock sprintf() to display floating-point numbers. There are
> >variants of dtoa in netlib and libg++.
>
> Some simple examples of what dtoa do differently?
The gateway from the mailing list to Usenet is (still?) broken, so
I'll repeat an example I mailed earlier.
IEC 60559 Full precision Desired display
--------- -------------- ---------------
0x4008fbe76c8b4395 3.1229999999999998 3.1229999999999998
0x4008fbe76c8b4396 3.1230000000000002 3.123
0x4008fbe76c8b4397 3.1230000000000007 3.1230000000000007
The criteria that I'm looking to satisfy are:
1) Round trip - reading a written number should give the same result
2) Write the minimum number of digits - drop trailing zeros/nines
--
Pete Forman -./\.- Disclaimer: This post is originated
Western Geophysical -./\.- by myself and does not represent
pete.forman at westgeo.com -./\.- the opinion of Baker Hughes or
http://www.crosswinds.net/~petef -./\.- its divisions.
More information about the Python-list
mailing list