[python] struct module round off error?

David Stockwell winexpert at hotmail.com
Fri Jun 11 10:25:48 EDT 2004


Hi Peter,

Thanks for the help.  I took a look at the link and then my python bible 
book and now see whats going on.  I must have been not paying attention 
during the tutorial on this part because I DID go through the whole thing...


> > When I first set it and print it, it has the correct value  (50.3).
> >
> > However all i did was pack it, and then unpack it and it lost its
> > definite value of 50.3.
> > After the unpack it was approximately 50.3 (50.29999......)
>
>Actually, they have the same value each time.  See
http://www.python.org/doc/faq/general.html#why-are-floating-point-calculations-so-inaccurate
>for more...
>
>(Hint: try repr(d) right after you do d=50.3 and see what you get.)



Thanks for the help

David Stockwell
-------
Tracfone: http://cellphone.duneram.com/index.html
Cam: http://www.duneram.com/cam/index.html
Tax: http://www.duneram.com/index.html

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar – get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/





More information about the Python-list mailing list