Sunday, 11 August 2013

Python 2: Why does round(2.49999999999999992) returns 3

Python 2: Why does round(2.49999999999999992) returns 3

I'm working on the math program and I have a quite big problem with round.
So after my program did some math, it rounds the result.
Everything works fine but if the result == 2.49999999999999992 , round
function return 3.0 instead of 2.0.
How can I fix that?
Thanks.

No comments:

Post a Comment