0

I'm trying to run the following calculation in JavaScript, 78.98 * 10 and the result returned is always 789.8000000000001 My question is where did that 0.0000000000001 come from?

I tried on several calculators, and that 0.0000000000001 should not be there. I did inclusive tests in other programming languages.

My question is, is there a logical explanation for this? If it is an error in the JavaScript engine where I notify?

Thank you.

Hiago Souza
  • 171
  • 1
  • 2
  • 12
  • Also, read https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html – thedarkone Oct 19 '17 at 12:40
  • i would like to introduce you to the wonders of float data types. – Maru Oct 19 '17 at 12:42
  • "I did inclusive tests in other programming languages" - maybe not as inclusive as you think, this is common to most languages (they might be fudging the results), check out http://0.30000000000000004.com/ for cross language examples of a simple .1 + .2 calculation :) – delinear Oct 19 '17 at 12:43
  • Thank you guys. ;) – Hiago Souza Oct 19 '17 at 12:54

0 Answers0