0

I have an application which sums up different numbers and I found out that there was a strange number in the application which was not showing the total of two numbers. I figured out that it is Javascript which is responsible for this number.

Does anybody have an idea why this sum results in this unexpected number?

I typed it also in the Chrome console:

enter image description here

Klyner
  • 3,983
  • 4
  • 26
  • 50
  • Read "what every programmer should know about floating point": google this out. – Tarik Dec 08 '20 at 13:50
  • Duplicate of this question: https://stackoverflow.com/questions/1458633/how-to-deal-with-floating-point-number-precision-in-javascript -- it is not at all unexpected, but an inherent problem of dealing with binary floating point numbers: You can express e.g. 0.2 exactly in decimal, but not in binary. – orithena Dec 08 '20 at 13:52

0 Answers0