Math
Through the Math module features such as rounding, calculating power and trigonometric functions can be accessed. This synchronous methods for mathematical operations are designed to be efficient for real-time calculations.
round()
Rounds a number to the specified number of digits to keep.
round(originalNumber: number, keepDigits: number): number;
ceil()
Rounds a number up to the specified number of digits to keep.
ceil(originalNumber: number, keepDigits: number): number;
floor()
Rounds a number down to the specified number of digits to keep.
floor(originalNumber: number, keepDigits: number): number;
max()
Gets the maximum value between two numbers.
max(value1: number, value2: number): number;
min()
Gets the minimum value between two numbers.
min(value1: number, value2: number): number;
pow()
Returns the value of a base expression taken to a specified power.
pow(base: number, exponent: number): number;
sqrt()
Returns the square root of a number.
sqrt(value: number): number;
abs()
Returns the absolute value of a number.
abs(value: number): number;
sin()
Returns the sine of the given angle (in degrees).
sin(value: number): number;
cos()
Returns the cosine of the given angle (in degrees).
cos(value: number): number;
tan()
Returns the tangent of the given angle (in degrees).
tan(value: number): number;
mean()
Computes the mean value of a list of numeric values.
mean(data: number[]): number;
median()
Computes the median value of a list of numeric values.
median(data: number[]): number;
randint()
Returns a random integer between the specified min and max values.
randint(min: number, max: number): number;
random()
Returns a random float between 0 and 1.
random(): number;