Math Static

Provides constants and static methods for trigonometric, logarithmic, and other common mathematical functions.

Constants

The value of a constant cannot be changed

Type Name Value Description
number Pi 3.141592653589793 Represents the natural logarithmic base, specified by the constant, π.
number E 2.718281828459045 Represents the ratio of the circumference of a circle to its diameter, specified by the constant, e.
number Tau 6.283185307179586 Represents the number of radians in one turn, specified by the constant, τ.
number Infinity Infinity Represents the positive infinity value.
number NaN NaN Represents a value that is not a number (NaN).
number Epsilon 5E-324 Represents the smallest positive numeric value greater than zero.
number MinValue -1.7976931348623157E+308 Represents the smallest possible value of a Double.
number MaxValue 1.7976931348623157E+308 Represents the largest possible value of a Double.

Functions

Abs(number)

Returns the absolute value of

Abs(value: number) -> number
Type Name Description
number value

Acos(number)

Returns the arc cosine of x (in radians).

Acos(value: number) -> number
Type Name Description
number value

Asin(number)

Returns the angle whose sine is the specified number.

Asin(value: number) -> number
Type Name Description
number value A number representing a sine, where must be greater than or equal to -1, but less than or equal to 1.

Atan(number)

Returns the arc tangent of x (in radians).

Atan(value: number) -> number
Type Name Description
number value

Atan2(number,number)

Returns the arc tangent of y/x (in radians), but uses the signs of both parameters to find the quadrant of the result. (It also handles correctly the case of x being zero.)

Atan2(y: number,x: number) -> number
Type Name Description
number y
number x

Cbrt(number)

Returns the cube root of x.

Cbrt(value: number) -> number
Type Name Description
number value

Ceil(number)

Returns the smallest integer larger than or equal to x.

Ceil(value: number) -> number
Type Name Description
number value

Clamp(number,number,number)

Returns clamped to the inclusive range of and .

Clamp(value: number,min: number,max: number) -> number
Type Name Description
number value The value to be clamped.
number min The lower bound of the result.
number max The upper bound of the result.

Cos(number)

Returns the cosine of x (assumed to be in radians).

Cos(value: number) -> number
Type Name Description
number value

Cosh(number)

Returns the hyperbolic cosine of x.

Cosh(value: number) -> number
Type Name Description
number value

Deg(number)

Returns the angle x (given in radians) in degrees.

Deg(value: number) -> number
Type Name Description
number value

Exp(number)

Returns the value e power x.

Exp(value: number) -> number
Type Name Description
number value

Floor(number)

Returns the largest integer smaller than or equal to x.

Floor(value: number) -> number
Type Name Description
number value

InverseLerp(number,number,number)

Returns a normalized value considering the given range. This is the opposite of .

InverseLerp(from: number,to: number,weight: number) -> number
Type Name Description
number from The start value for interpolation.
number to The destination value for interpolation.
number weight The interpolated value.

Lerp(number,number,number)

Linearly interpolates between two values by a normalized value. This is the opposite .

Lerp(from: number,to: number,weight: number) -> number
Type Name Description
number from The start value for interpolation.
number to The destination value for interpolation.
number weight A value on the range of 0.0 to 1.0, representing the amount of interpolation.

Log(number)

Returns the natural logarithm of x.

Log(value: number) -> number
Type Name Description
number value

Log(number,number)

Returns the base-y logarithm of x.

Log(x: number,y: number) -> number
Type Name Description
number x
number y

Log10(number)

Returns the base-10 logarithm of x.

Log10(value: number) -> number
Type Name Description
number value

Max(number,number)

Returns the maximum value among its arguments.

Max(x: number,y: number) -> number
Type Name Description
number x
number y

Min(number,number)

Returns the minimum value among its arguments.

Min(x: number,y: number) -> number
Type Name Description
number x
number y

Mod(number,number)

Modulo of x % y

Mod(x: number,y: number) -> number
Type Name Description
number x
number y

Pow(number,number)

Returns a specified number raised to the specified power.

Pow(x: number,y: number) -> number
Type Name Description
number x A number to be raised to a power.
number y A number that specifies a power.

Round(number)

Rounds to the nearest integer

Round(value: number) -> number
Type Name Description
number value

Round(number,number)

Rounds a value to a specified number of digits, and rounds midpoint values to the nearest even number.

Round(value: number,decimals: number) -> number
Type Name Description
number value
number decimals The number of digits in the return value

Sign(number)

Returns a value of 1 when x greater than zero, returns 0 when x equals zero, and returns -1 when x is less than zero.

Sign(x: number) -> number
Type Name Description
number x

Sin(number)

Returns the sine of x (assumed to be in radians).

Sin(value: number) -> number
Type Name Description
number value

Sinh(number)

Returns the hyperbolic sine of x.

Sinh(value: number) -> number
Type Name Description
number value

Sqrt(number)

Returns the square root of x. (You can also use the expression x^0.5 to compute this value.)

Sqrt(value: number) -> number
Type Name Description
number value

Tan(number)

Returns the tangent of x (assumed to be in radians).

Tan(value: number) -> number
Type Name Description
number value

Tanh(number)

Returns the hyperbolic tangent of x.

Tanh(value: number) -> number
Type Name Description
number value

Truncate(number)

Returns the integral part of a specified number.

Truncate(value: number) -> number
Type Name Description
number value

Categories:

Updated: