When I add numbers from a list, I get an extra .00000000003. Where does that come from?
Here's my list of numbers
list = [210.0, 140.0, 171.0, 70.0, 625.0, 187.5, 70.0, 1496.89]
When I get a total sum of all the numbers, I get 2970.3900000000003
>>> sum(list)
2970.3900000000003
>>> total = 0
>>> for x in list:
... total += x
...
>>> total
2970.3900000000003
But say I print, the total comes out as regular
>>> total = 0
>>> for x in list:
... total += x
... print total
...
210.0
350.0
521.0
591.0
1216.0
1403.5
1473.5
2970.39
Where do those extra sig figs come from and how can I avoid it when using it elsewhere?