xtr.math¶
abs¶
abs(num: Number): Number
Returns the absolute value of the given num.
Example
Resultacos¶
acos(x: Number): Number
Returns the arc cosine of the given x.
Example
Resultasin¶
asin(x: Number): Number
Returns the arc sine of the given x.
Example
Resultatan¶
atan(x: Number): Number
Returns the arc tangent of the given x.
Example
Resultavg¶
avg(array: Array[Number]): Number
Returns the average of the numbers in array.
Example
Resultceil¶
ceil(num: Number): Number
Returns the ceiling (aka round up) of the given num.
Example
Resultclamp¶
clamp(x: Number, minVal: Number, maxVal: Number): Number
Returns x if it exists between minVal and maxVal, otherwise the one that is closest.
Example
Resultcos¶
cos(x: Number): Number
Returns the cosine of the given x.
Example
Resultexp¶
exp(x: Number): Number
Returns Euler's number e, to the power of x.
Example
Resultexponent¶
exponent(x: Number): Number
Returns the exponent portion of the double-precision binary floating-point representation (IEEE 754:binary64) of the given x.
Example
Resultfloor¶
floor(num: Number): Number
Returns the floor (aka round down) of the given num.
Example
Resultlog¶
log(x: Number): Number
Returns the natural logarithm of the given x.
Example
Resultmantissa¶
mantissa(x: Number): Number
Returns the fraction portion (aka significand) of the double-precision binary floating-point representation (IEEE 754:binary64) of the given x.
Example
Resultpow¶
pow(num1: Number, num2: Number): Number
Returns the value of num1 raised to the power of num2.
Example
Resultrandom¶
random(): Number
Returns a pseudo-random double-precision floating-point number between 0 and 1.
Example
ResultrandomInt¶
randomInt(num: Number): Number
Returns a pseudo-random integer between 0 (inclusive) and the given num (exclusive). A num of zero or less is an error.
Example
Resultround¶
round(num: Number, mode: String = 'half-up', precision: Number = 0): Number
Rounds the given num using the mode and precision requested. Supported modes are up, down, half-up, half-down, ceiling, floor, and half-even.
Example
Resultsin¶
sin(x: Number): Number
Returns the sine of the given x.
Example
Resultsqrt¶
sqrt(num: Number): Number
Returns the square root of the given num.
Example
Resultsum¶
sum(array: Array[Number]): Number
Returns the sum of all numbers in array.
Example
Resulttan¶
tan(x: Number): Number
Returns the tangent of the given x.
Example
Result