Try using Math.ceil or Math.floor just in case.
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Paul
Steven
Sent: 06 March 2006 14:03
To: Flashcoders mailing list
Subject: [Flashcoders] Strange behaviour from modulus operator
Experiencing a strange
How much closer to zero where you expecting? 5 to the power of 10 to the
-14 is zero to the limits of modern PCs.
If you want to deal with integers make the numbers integers. If you do
your math in floating point with a mantissa with lots of bits, you are
going to get some bits left over at t
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Strange behaviour from modulus operator
Because _x is not necessarily an integer, vValue1 is not guaranteed to
be an integer either, which it must be for modulo to return the result
you want. Force it to be with
var vValue1 = Math.round
Experiencing a strange problem using the modulus operator.
Inside a function I have the following code:
var vValue1 = passed_MC._x - this.Maze_Horizontal_offset;
var vValue2 = 36;
var vTheResult = vValue1 % vValue2;
trace ("vValue1 = " + vValue1);
trace ("vTheResult = " + Number(vTheResult
Because _x is not necessarily an integer, vValue1 is not guaranteed to
be an integer either, which it must be for modulo to return the result
you want. Force it to be with
var vValue1 = Math.round(passed_MC._x - this.Maze_Horizontal_offset);
and it should work as you expect.
Helen
--
http:/
Experiencing a strange problem using the modulus operator.
Inside a function I have the following code:
var vValue1 = passed_MC._x - this.Maze_Horizontal_offset;
var vValue2 = 36;
var vTheResult = vValue1 % vValue2;
trace ("vValue1 = " + vValue1);
trace ("vTheResult = " + Number(vTheResult));
6 matches
Mail list logo