Ah, thank you ham and brie, I was mistaken. I thought that Number was an integer format with max_value=10³⁰⁸; I (foolishly) didn't realize that it was a floating point number. I jumped to the wrong conclusion, because the AS3 documentation recommended using Number over int for big integers (which is horrible
advice). I should be more careful when it comes to languages I know so little about.
is a double precision floating point number
(FP64) and is therefore somewhat unsuitable for handling integers (it will start to bug out for big numbers and has some nasty side effects). It is the same as double
in languages like Java.
But Number is not the same as Java's long. A long in Java is an int64, which has a much lower max_value (~10¹⁹) than a double's max_value (~10³⁰⁸). But in return int64 actually works for big numbers, as it is able store every integer up to it's limit (while Number/double just tries to approximate
Anyway, back to the actual question: Does AS3 have Big Integer support?
The answer seems to be no, it does not. At least not as a built-in. This is no reason for despair, though. The Project Euler problems were probably created under the assumption that you wouldn't have access to a BigInteger class. The actual challenge (that many of us have circumvented) is to implement your own handling of big integers (like Andy Wolff has)
First off you should probably do some reading on how integers are represented. Then write a simple class that supports what you need. You can have stuff like someBigInt.add(someOtherNumber). Where "someOtherNumber" can be an integer, another BigInt or a string representation of a number. Internally you can store the number as a String (Andy Wolff's approach), but I think you'll get better results if you store it as an array (or list) of unsigned integers (uint).
Or if you don't feel up to the task you can always use someone else's full-fledged BigInt implementation, perhaps this one?http://kingtut666.wordpress.com/2011/04/19/bigint-in-actionscript-3-0/
(But do note that your own implementation would be much simpler that this one, because you don't need everything that is supported in that library)