javascript - decimal point - TechRepublic
General discussion
October 2, 2002 at 12:47 AM
anderson sá

javascript – decimal point

by anderson sá . Updated 23 years, 9 months ago

Why JavaScrit is doing this, when I use calculations with decimal point?

Look:
4.4 + .4 = 4.800000000000001 — right(4.8)
3.3 + .3 = 3.5999999999999996 — right(3.6)
6.6 + .6 = 7.199999999999999 — right(7.2)

code:
num1 = parseFloat(4.4) +parseFloat(.4);

If there are something that I can do, please send me.

Thanks
Anderson

This discussion is locked

All Comments