var i = 0;
var j= 0.8;
j*=10
onEnterFrame = function () {
i = i + 1;
trace (i);
if (i == j) trace("here");
}
Or is that just not possible (ie you don't know how many decimal spaces j
will have)?
On 12/4/05, Hans Wichman <[EMAIL PROTECTED]> wrote:
>
> Hi peeps,
> related discussions have been on here before, but i didn't find a real
> answer.
> Imagine this piece of code:
> var i = 0;
>
> onEnterFrame = function () {
> i = i + 0.1;
> trace (i);
> if (i == 0.7) trace("here");
> }
>
> as you might expect, after running for 7 frames, it traces "here".
> However if you change 0.7 to 0.8, it stops working.
>
> I assume this is to floating point math and rounding errors and stuff?
> In what way can i check for equality to 0.7 then? With a bigger than,
> smaller than construction?
>
> This seems so weird to me...
>
> greetz
> Hans
>
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
--
Toon Van de Putte
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders