Math
Module Function​
abs(FLOAT)​
Returns
FLOAT
acos(FLOAT)​
Returns
FLOAT
Returns the arccosine, in radians, of the argument
🚀 > Math.acos(1.0)
=> 0.0
asin(FLOAT)​
Returns
FLOAT
Returns the arcsine, in radians, of the argument
🚀 > Math.asin(0.0)
=> 0.0
atan(FLOAT)​
Returns
FLOAT
Returns the arctangent, in radians, of the argument
🚀 > Math.atan(0.0)
=> 0.0
ceil(FLOAT)​
Returns
FLOAT
Returns the least integer value greater or equal to the argument
🚀 > Math.ceil(1.49)
=> 2.0
copysign(FLOAT, FLOAT)​
Returns
FLOAT
Returns a value with the magnitude of first argument and sign of second argument
🚀 > Math.copysign(3.2, -1.0)
=> -3.2
cos(FLOAT)​
Returns
FLOAT
Returns the cosine of the radion argument
🚀 > Math.cos(Pi/2)
=> 0.0
exp(FLOAT)​
Returns
FLOAT
Returns e**argument, the base-e exponential of argument
🚀 > Math.exp(1.0)
=> 2.72
floor(FLOAT)​
Returns
FLOAT
Returns the greatest integer value less than or equal to argument
🚀 > Math.floor(1.51)
=> 1.0
log(FLOAT)​
Returns
FLOAT
Returns the natural logarithm of argument
🚀 > Math.log(2.7183)
=> 1.0
log10(FLOAT)​
Returns
FLOAT
Returns the decimal logarithm of argument
🚀 > Math.log(100.0)
=> 2.0
log2(FLOAT)​
Returns
FLOAT
Returns the binary logarithm of argument
🚀 > Math.log2(256.0)
=> 8.0
max(FLOAT, FLOAT)​
Returns
FLOAT
Returns the larger of the two numbers
🚀 > Math.max(5.0, 10.0)
=> 10.0
min(FLOAT, FLOAT)​
Returns
FLOAT
Returns the smaller of the two numbers
🚀 > Math.min(5.0, 10.0)
=> 5.0
pow(FLOAT, FLOAT)​
Returns
FLOAT
Returns argument1**argument2, the base-argument1 exponential of argument2
🚀 > Math.pow(2.0, 3.0)
=> 8.0
rand()​
Returns
FLOAT
Returns a pseudo-random number in the half-open interval [0.0, 1.0].
🚀 > Math.rand()
=> 0.6046602879796196
remainder(FLOAT, FLOAT)​
Returns
FLOAT
Returns the IEEE 754 floating-point remainder of argument1/argument2
🚀 > Math.remainder(100.0, 30.0)
=> 10.0
round(FLOAT)​
Returns
FLOAT
Returns the nearest integer, rounding half away from zero
🚀 > Math.round(73.3)
=> 73.0
sin(FLOAT)​
Returns
FLOAT
Returns the sine of the radion argument
🚀 > Math.sin(Pi)
=> 0.0
sqrt(FLOAT)​
Returns
FLOAT
Returns the square root of argument
🚀 > Math.sqrt(3.0 * 3.0 + 4.0 * 4.0)
=> 5.0
tan(FLOAT)​
Returns
FLOAT
Returns the tangent of the radion argument
🚀 > Math.tan(0.0)
=> 0.0
Properties​
Name | Value |
---|---|
E | 2.718281828459045 |
Ln10 | 2.302585092994046 |
Ln2 | 0.6931471805599453 |
Log10E | 0.4342944819032518 |
Log2E | 1.4426950408889634 |
Phi | 1.618033988749895 |
Pi | 3.141592653589793 |
Sqrt2 | 1.4142135623730951 |
SqrtE | 1.6487212707001282 |
SqrtPhi | 1.272019649514069 |
SqrtPi | 1.772453850905516 |