Packageorg.granite.util
Classpublic class NumberUtil

Static utility functions for ActionScript3's Numbers.



Public Methods
 MethodDefined by
  
getFractionPartLength(number:Number):int
[static] Returns the length of the fraction part of the number paremeter, if it was written in base 10 without any exponent.
NumberUtil
  
getIntegerFractionLengths(number:Number):Array
[static] Returns an array of two int values that represents the lengths of the integer and fraction parts of the number paremeter, if it was written in base 10 without any exponent.
NumberUtil
  
getIntegerPartLength(number:Number):int
[static] Returns the length of the integer part of the number paremeter, if it was written in base 10 without any exponent.
NumberUtil
Method detail
getFractionPartLength()method
public static function getFractionPartLength(number:Number):int

Returns the length of the fraction part of the number paremeter, if it was written in base 10 without any exponent.

Note: this method seems to be only reliable with numbers between -9999999999999998 and +9999999999999998 (inclusive), made from no more than 16 significants digits and with an optional dot anywhere (only empirical)...

Parameters
number:Number — the number from wich to get fraction part length.

Returns
int — the fraction part length or -1 if the supplied number is NaN or infinite.
getIntegerFractionLengths()method 
public static function getIntegerFractionLengths(number:Number):Array

Returns an array of two int values that represents the lengths of the integer and fraction parts of the number paremeter, if it was written in base 10 without any exponent.

Note: this method seems to be only reliable with numbers between -9999999999999998 and +9999999999999998 (inclusive), made from no more than 16 significants digits and with an optional dot anywhere (only empirical)...

Parameters
number:Number — the number from wich to get integer and the fraction part lengths.

Returns
Array — an array that contains the integer and the fraction parts lengths or [-1, -1] if the supplied number is NaN or infinite.
getIntegerPartLength()method 
public static function getIntegerPartLength(number:Number):int

Returns the length of the integer part of the number paremeter, if it was written in base 10 without any exponent.

Note: this method seems to be only reliable with numbers between -9999999999999998 and +9999999999999998 (inclusive), made from no more than 16 significants digits and with an optional dot anywhere (only empirical)...

Parameters
number:Number — the number from wich to get interger part length.

Returns
int — the integer part length or -1 if the supplied number is NaN or infinite.