Name
isFinite( ) Global Function — check if a number is less than Infinityand greater than -Infinity
Availability
Flash 5
Synopsis
isFinite(number)
Arguments
- number
Any numeric value or expression that yields a numeric value.
Returns
A Boolean value; true if the number falls between
Number.MAX_VALUE and
-Number.MAX_VALUE (inclusive),
false if not. If number
does not belong to the number datatype,
number is converted to the
number type before isFinite(
) executes.
Description
The isFinite( ) function simply checks if a
number is in the legal numeric value range of ActionScript. Use
isFinite( ) before executing code that requires
a legitimate number to operate properly.
Example
if (!isFinite(x * y)) { // Test if the number is not finite
trace ("The answer is too large to display. Try again.");
}
isFinite(-2342434); // Yields true
isFinite(Math.PI); // Yields true
isFinite(Number.MAX_VALUE * 2) // Yields falseSee Also
-Infinity, Infinity,
isNan( ),
Number.MAX_VALUE,
Number.MIN_VALUE; Section 4.3.3 in Chapter 4
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access