Weird floating point results

Posted by pocoa on Stack Overflow See other posts from Stack Overflow or by pocoa
Published on 2010-05-21T16:29:03Z Indexed on 2010/05/21 16:30 UTC
Read the original article Hit count: 186

Filed under:
|
|
>>> float(1)
1.0
>>> float(1) / 10
0.10000000000000001
>>> 4 + (float(1) / 10)
4.0999999999999996

4 + (float(1) / 10) is expected to be 4.10000000000000001

Is this a kind of bug?

© Stack Overflow or respective owner

Related posts about python

Related posts about floating-point