3

We are doing some maths with large integers in Actionscript 3. Because there is no long type, we are using Number.

What's the range of consecutive integers (positive to negative) a Number can accurately represent before it starts to veer into floating point errors?

ICR
  • 13,896
  • 4
  • 50
  • 78
  • 2
    The Number data type can use up to 53 bits to represent integer values http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Number.html – The_asMan Sep 13 '13 at 14:35

2 Answers2

5

ActionScript® 3.0 Reference for the Adobe® Flash® Platform states that the Number data type adheres to the double-precision IEEE-754 standard. In IEEE-754 double-precision, there are 64 bits in use (1 for sign bit, 11 bits for exponent and 52 bits for fraction).

Therefor maximum integer range should be approximately ±1.7976931348623157×(10^308)

See Also MAX_VALUE and MIN_VALUE in Number class.

Amith Chinthaka
  • 1,015
  • 1
  • 17
  • 24
1

To answer the original question, when not using a floating point representation the integer range is up to 253-1 (the sign is in a different bit). +/- 9007199254740991

source

Community
  • 1
  • 1