Why do I get 90.370+1.180+8.450 = 100.00000000000001 in Javascript?

29 Views Asked by At

I am trying to add three numbers "90.370", "1.180" and 8.450. And I get the result as 100.00000000000001. when I slightly change these values I am getting exact 100. Can someone please explain me this. 90.370+1.180+8.450 = 100.00000000000001 90.350+1.200+8.450 = 100 image shows above addition operation in chrome console

How to correct this and get the correct value in all the cases.

0

There are 0 best solutions below