Math
The math
package provides a series of mathematical functions.
Function Name | Description |
---|---|
abs(n: number ): number | Returns the absolute value of n |
acos(n: number ): number | Returns the arccosine of n |
asin(n: number ): number | Returns the arcsine of n |
atan(n: number ): number | Returns the arctangent of n |
ceiling(n: number ): number | Returns the smallest integer greater than or equal to n |
floor(n: number ): number | Returns the largest integer less than or equal to n |
round(n: number ): number | Rounds n to the nearest integer |
cos(n: number ): number | Returns the cosine of n |
exp(n: number ): number | Returns e raised to the power of n |
fracpart(n: number ): number | Returns the fractional part of n |
intpart(n: number ): number | Returns the integer part of n |
ln(n: number ): number | Returns the natural logarithm (base e ) of n |
log(n: number ): number | Returns the logarithm (base 10) of n |
sin(n: number ): number | Returns the sine of n in radians |
sqrt(n: number ): number | Returns the square root of n |
tan(n: number ): number | Returns the tangent of n |
max(n1: number? , n2: number? , ...): number | Returns the largest value among the input parameters |
min(n1: number? , n2: number? , ...): number | Returns the smallest value among the input parameters |
mod(n: number ): number | Returns the remainder of a divided by b |
pow(n: number ): number | Returns a raised to the power of b |
reverse(n: number ): number | [Deprecated] Changes the sign of n |
sgn(n: number ): number , sign(n: number ): number | [Deprecated] Returns the sign of n . If n > 0 , returns 1 ; if n = 0 , returns 0 ; if n < 0 , returns -1 |
isnil(n: number ): bool | Returns true if n is NAN , +INF , or -INF ; otherwise, returns false |