0

Has anyone come across the problem where you add certain numbers such as 3.2 + 3.6 in python 3 you get an output like "6.800000000000001". This has occurred when I was using Python 3.8. One other set of numbers I added was 2.6 + 2.2 which gave the same result. Does anyone know why this happens, and only on these few numbers?

print (3.6 + 3.2)
print (2.6 + 2.2)
NFuze
  • 1

1 Answers1

0

You'll find some good info/explanations in Python docs themselves about floating point arithmetic in computers.

Kache
  • 15,647
  • 12
  • 51
  • 79