Number.MAX_VALUE Property | Flash 5 |
the largest representable positive number in ActionScript | read-only |
The MAX_VALUE property returns the largest representable positive number in ActionScript (1.79769313486231e+308). It is convenient when you want to start with a very large value, as shown in the following Example. Any number greater than MAX_VALUE can't be represented by ActionScript and is therefore considered to be POSITIVE_INFINITY (i.e., Infinity).
Here we are looking for a minimum value in an array. We initialize the minVal variable to MAX_VALUE, knowing that any subsequent value will be less than it:
var myArray = [-10, 12, 99]; var minVal = Number.MAX_VALUE; for (var thisValue in myArray) { if (myArray[thisValue] < minVal) { minVal = myArray[thisValue]; } } trace ("The minimum value is " + minVal);
Infinity, Number.MIN_VALUE, Number.POSITIVE_INFINITY; Section 4.3.3