org.as2lib.core.BasicClass +--org.as2lib.util.MathUtil
MathUtil
contains fundamental math operations.
static public function isOdd(n:Integer):Boolean
Checks if the passed-in integer n
is odd.
n | the integer to check |
true
if n
is odd else false
static public function isEven(n:Integer):Boolean
Checks if the passed-in integer n
is even.
n | the integer to check |
true
if n
is even else false
static public function isInteger(n:Number):Boolean
Checks if the passed-in number n
is an integer.
n | the number to check |
true
if n
is an integer else false
static public function isNatural(n:Number):Boolean
Checks if the passed-in number n
is natural.
n | the number to check |
true
if n
is natural else false
static public function isPrime(n:NaturalNumber):Boolean
Checks if the passed-in number n
is a prime.
A prime number is a positive integer that has no positive integer divisors other than 1 and itself.
n | the number to check |
true
if n
is a prime else false
static public function factorial(n:NaturalNumberIncludingZero):Number
Calculates the factorial of the passed-in number n
.
n | the number to calculate the factorial of |
the factorial of n
static public function getDivisors(n:NaturalNumberIncludingZero):Array
Returns an array with all divisors of the passed-in number n
n | the number to return the divisors of |
an array that contains the divisors of n