Consider the following calculation
3 * 20.9
normally it equals to 62.7
. However, when I calculate it in javascript, the output is 62.699999999999996
. And what's more I found that 7
, 11
will also produce the wrong answer. Why it goes wrong and how to make it right? I think it's about the binary?