dimanche 25 juin 2017

Why JS Calculation give Me different answer..?

Anyone can explain why Every-time i did get below answer. when i try to add like 0.2 + 0.3 it will give me 0.30000000000000004 it should be 0.3.

0.2 + 0.3
= 0.30000000000000004

but when i try to add like 1.2 + 1.3 Then it will give me 2.3 that is right.

1.2 + 0.3 = 2.3

so why i try to add 0.2 + 0.3 then it will give me 0.00000000000000004 extra in my calculation.




Aucun commentaire:

Enregistrer un commentaire