0.1 + 0.2 = 0.30000000000000004 !!!???

Let’s do some simple math. What is 0.1 + 0.2? It’s 0.3. Very simple, isn’t it? Let’s see what your computer says. Open your browser console (press Ctrl + Shift + J on chrome or Ctrl + Shift + I on firefox and then got to console tab) and type 0.1 + 0.2 and press enter. What do you see?

Interesting, isn’t it? You can also try 0.3 + 0.6. If you think that, javascript is a bad language and it can’t handel math properly, then you are wrong. You can also try this in java or in python or in c or any of you favorite language. If you don’t want to run all the languages please have a look at https://0.30000000000000004.com/ . The question is why. Why all programming languages are unable to handle so simple math? The answer is it’s not a language issue. It’s a more general computer problem.

Read more