Rounding issue when adding floats in python, is this normal?
- by thepearson
I just wanted to know if this behavior is expected. If so, can someone explain to me why.
This has probably been answered elsewhere I can't seem to find it using Google. Probably not searching with the right terms. I am running Ubuntu 10.04.
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> var = 10.0
>>> var
10.0
>>> var + 5
15.0
>>> var + 5.1
15.1
>>> var + 5.2
15.199999999999999
>>>