hi i was doing some work in javascript and found the following error
consider the code
Code:
function fnCalc() {
var a = 30.01;
var b = 30.02;
alert(a + b);//60.03
var c = 30.01;
var d = 30.03;
alert(c + d);//60.040000000000006
}
The first alert gives 60.03 and the second 60.040000000000006
can any one tell me why this happens and how to solve. i faced the same problem with another number but it works for that now
thanks