I have a Python script which saves measurement values in a csv file. I then read the csv into another python script which checks whether the results sum up to 1.0. I noticed that my comparison script often returns false, even though if I do print(my_sum), the printed result is 1.0. Similarly, summing up the values using excel gives exactly 1.0.
Here are my example values:
x = 0.926119895097366
y = 0.0248330035844995
z = 0.0490471013181347
The check if (x+y+z) == 1.0 failed. However, when I do print(x+y+z), the value printed is 1.0. Similarly, using excel to sum those values gives 1.0. However, when I run the summation in Ipython, the result is 1.0000000000000002. What is causing it?
 
    