Rounding Bug in Python 2.0! - ugh

Pete Forman gsez020 at kryten.bedford.waii.com
Thu Nov 2 05:54:47 EST 2000


Moshe Zadka writes:
 > On Wed, 1 Nov 2000, Pete Forman wrote:
 > 
 > > 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
 > 
 > Unfortunately, it's not well defined if you won't cross-computer
 > round-trip. And you better believe that it's needed -- if you write
 > out your data file, you might want to read it on a computer in your
 > home too.

But it is well defined.  The number of decimal digits printed should
be just enough so that I can eval() it to get exactly the same binary
representation that I started with.  If your home computer uses the
same internal binary format for floating point, then it should be able
to read it exactly as well.  (If these two machines use different
binary formats then lossless conversion will not be possible.)
-- 
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