math
Last updated
Last updated
Direct copy of Roblox's (and in turn Lua's) math library: The table below is AI generated and has been provided for your convenience, but you should use the Roblox documentation for this instead. (i couldn't bother writing this myself)
abs(x: number)
Returns the absolute value of x
.
acos(x: number)
Returns the arc cosine of x
in radians.
asin(x: number)
Returns the arc sine of x
in radians.
atan(x: number)
Returns the arc tangent of x
in radians.
ceil(x: number)
Returns the smallest integer greater than or equal to x
.
cos(x: number)
Returns the cosine of x
(in radians).
cosh(x: number)
Returns the hyperbolic cosine of x
.
deg(x: number)
Converts x
from radians to degrees.
exp(x: number)
Returns e
raised to the power of x
.
floor(x: number)
Returns the largest integer less than or equal to x
.
frexp(x: number)
Breaks x
into its normalized fraction and exponent.
log10(x: number)
Returns the base-10 logarithm of x
.
modf(x: number)
Returns the integer and fractional parts of x
.
rad(x: number)
Converts x
from degrees to radians.
randomseed(seed: number)
Seeds the random number generator with the given seed.
round(x: number)
Rounds x
to the nearest integer.
sign(x: number)
Returns the sign of x
: -1 if x
is negative, 1 if positive, and 0 if zero.
sin(x: number)
Returns the sine of x
(in radians).
sinh(x: number)
Returns the hyperbolic sine of x
.
sqrt(x: number)
Returns the square root of x
.
tan(x: number)
Returns the tangent of x
(in radians).
tanh(x: number)
Returns the hyperbolic tangent of x
.
atan2(y: number, x: number)
Returns the arc tangent of y/x
in radians.
fmod(a: number, b: number)
Returns the remainder of a
divided by b
.
idexp(x: number)
Returns the mantissa and exponent of x
.
log(x: number)
Returns the natural logarithm of x
.
max(a: number, b: number)
Returns the maximum of a
and b
.
min(a: number, b: number)
Returns the minimum of a
and b
.
pow(base: number, exponent: number)
Returns base
raised to the power of exponent
.
random(min: number, max: number)
Returns a random number in the range.
clamp(value: number, min: number, max: number)
Clamps value
between min
and max
.
noise(x: number)
Returns the noise value for x
.