newbie seeks inaccurate arithmetic insight
Fredrik Lundh
fredrik at pythonware.com
Mon Apr 30 11:41:04 EDT 2001
Stanley Krute wrote:
> Hmmm. Here's a corresponding c program
>
> http://static.userland.com/images/stanleydaily/carithmeticprogram.gif
try using "%.17g" (show all significant digits) instead of "%f" (fudge it)
...or use "print" in Python, to get str() instead of repr() behaviour:
>>> 0.1
0.10000000000000001
>>> print 0.1
0.1
Cheers /F
More information about the Python-list
mailing list