[Javascript] Java script division error

Kim Hoogenberg kim.hoogenberg at virgil.nl
Fri Dec 3 08:57:35 CST 2004


sriram.v wrote:

> Hi All,
> I am gettting 114.9999998 during  alert(2.30/.02) , instead of 115. 
> Any idea why and how to fix this ?.....
>  
> With Regards,
> Sriram V.

floating point numbers are very unreliable if you use them like this, 
because of memory issues and the way they are implemented. Try using 
((2.3x100)/(.02x100)) or 230/2 instead..



More information about the Javascript mailing list