0
a = [0.0021, 0.0087]
s = sum(a)
print(s)

Outcome: 0.010799999999999999

When executing the program above, the result is complex and eronated.

After performing multiple tests, including:

a = 0.0021
b = 0.0087

The result is the same. I tried different combinations of numbers and it seems that only these 2 have such an odd outcome.

Afaris
  • 1

1 Answers1

0

I would say that this is floating point arithmetics error. Or I think there were some performance improvements done to math operations in Python which cause this, you can look more into it if you want by searching for PyNumber_Add and BINARY_ADD operation

Michał Darowny
  • 359
  • 1
  • 10