Possible Duplicate:
Is JavaScript's Math broken?
I have two variables
var first : float = 200;
var next : float;
next = first * 1.2;
and when i write in debug log "next" it gives 40,00002. any advices?
Possible Duplicate:
Is JavaScript's Math broken?
I have two variables
var first : float = 200;
var next : float;
next = first * 1.2;
and when i write in debug log "next" it gives 40,00002. any advices?
The precision of floating point computations is only as precise as the precision (no of bits and mantissa) it uses. http://en.wikipedia.org/wiki/Floating_point#Machine_precision_and_backward_error_analysis
This give you 240. I think your are not not following the standard. I even parsed it with float
var first =parseFloat(200.0);
var next ;
next = parseFloat(first * 1.2);
alert(next);