2.6.1 - simple division

Steve Holden steve at holdenweb.com
Sat Mar 14 16:01:06 CET 2009


farsight at gmail.com wrote:
> Thanks all, that's very helpful, sorry to waste your time with a
> common question. I have tried the decimal module and will definitely
> keep using it if I need to do this kind of calculation again.
> 
> I have 1 more question that the floating point article that was linked
> didn't really answer:
> 
>  >>> x = 0.8
>  >>> x
>  0.800000000000004
>  >>> x * 5
>  4.0
> 
> Shouldn't I be expecting something like 4.0000000000002 ?

How different is 4.0?

regards
 Steve
-- 
Steve Holden           +1 571 484 6266   +1 800 494 3119
Holden Web LLC                 http://www.holdenweb.com/
Want to know? Come to PyCon - soon! http://us.pycon.org/




More information about the Python-list mailing list