>I prefer uint over Number for representing a long.

To clarify, uint is just that: an unsigned 32-bit integer. A long is
(typically) a signed 64-bit integral number. A uint will allow you to
express numbers that are twice as large as the largest int, but that's
only a small fraction of the range of long (and it ignores the negative
range entirely).

A Number, as mentioned before, is an IEEE-754 double (64-bit floating
point number). The problem with representing longs as double is that at
some point, you'll find a long x such that

((Number) x) == ((Number) x + 1)

due to the properties of IEEE-754 floating point (i.e., there simply
aren't enough bits in the representation to distinguish those two). I'm
not sure what that long x is exactly.

So basically, there is no long in ActionScript. You can approximate one
with uint, you can approximate one with Number, or you can write your
own BigInteger class and do the math internally. That's probably going
to be quite ugly and complicated, especially since you can't use
operator overloading for basic arithmetic.
-- 
Maciek Sakrejda
Truviso, Inc.
http://www.truviso.com



Reply via email to