[Type] Math
Part of: mobl
Inherits from: mobl::Object
Implements various useful mathematical functions.
Static methods
round(n : Num) : Num
Rounds a number.
Example:
Math.round(1.5) // -> 2
floor(n : Num) : Num
Floors a number.
Example:
Math.floor(1.5) // -> 1
ceil(n : Num) : Num
Ceils a number.
Example:
Math.ceil(1.5) // -> 2
abs(n : Num) : Num
Returns the absolute value of n
.
Example:
Math.abs(1) -> // -> 1
Math.abs(-1) -> // -> 1
acos(n : Num) : Num
Returns the acos of n
.
asin(n : Num) : Num
Returns the asin of n
.
atan(n : Num) : Num
Returns the atan of n
.
atan2(n : Num, n2 : Num) : Num
Returns the atan2 of n
.
cos(n : Num) : Num
Returns the cos of n
.
exp(n : Num) : Num
Returns the exp of n
.
log(n : Num) : Num
Returns the log of n
.
pow(n1 : Num, n2 : Num) : Num
Returns the pow of n
and n2
.
random() : Num
Returns a random number between 0
and 1
.
sin(n : Num) : Num
Returns the sin of n
.
sqrt(n : Num) : Num
Returns the square root of n
.
tan(n : Num) : Num
Returns the tan of n
.
max(n1: Num, n2 : Num) : Num
Returns the maximum of two numbers.
Example:
Math.max(1, 2) // -> 2
pi() : Num
An approximation of Pi
Example:
Math.pi() // -> 3.1415...
isNaN(n : Num) : Bool
Determines if n
is not a number.
Example:
Math.isNaN(parseNum("one")) // -> true
mobl/math.txt · Last modified: 2013/10/01 02:28 (external edit)