ActionScript for Flash MX: The Definitive Guide, Second Edition

ActionScript for Flash MX: The Definitive Guide, 2nd EditionBy Colin Moock
Chapter 18.  ActionScript Language Reference
Infinity Global Property Flash 5

a constant representing an infinite number read-only

Infinity

Description

A number that exceeds the maximum allowed numeric value in ActionScript is represented by the numeric constant Infinity (although incalculable numbers are represented by NaN). The largest value allowed in ActionScript is represented by Number.MAX_VALUE, which equates to 1.79769313486231e+308. Exceeding the largest allowed number in ActionScript is known as an overflow condition and is typically caused by a mathematical error.

Example

The result of a calculation that exceeds the largest allowed number is Infinity. For example:

Number.MAX_VALUE * 2; // Yields Infinity

Infinity also results when dividing a positive number by zero:

1000 / 0; // Yields Infinity

Usage

Infinity is shorthand for Number.POSITIVE_INFINITY.

See Also

-Infinity, isFinite( ), NaN, Number.POSITIVE_INFINITY; Section 4.3.3

    Категории