Weird arithmetic in Python

Alex not_such_a_brain_after_all at mit.edu
Mon Oct 30 09:51:57 EST 2000


> > in 0.3, so the difference in precision is the result you see above
> > (5.55111512313e-17).
> >
> I comprehend that roundoff error could readily produce non-zero
> answers.  But what sort of roundoff causes .1 * 3 - .3 to be greater
> than 5?

It's not -- that 'e-17' you see at the end of the string of digits means
stick a decimal point and 16 zeros in front of the leading 5.

Alex.

-- 
Speak softly but carry a big carrot.




More information about the Python-list mailing list