Skip to navigation

Mathematical functions and constants.

Members

e

math.efloat

The mathematical constant e (approximately 2.71828).

pi

math.pifloat

The mathematical constant pi (approximately 3.14159).

acos

math.acos(x)

Returns the arccosine, in radians, of x.

Parameters
xfloat | intInput value
Returns
resultfloatThe computed result

acosh

math.acosh(x)

Returns the inverse hyperbolic cosine of x.

Parameters
xfloat | intInput value
Returns
resultfloatThe computed result

asin

math.asin(x)

Returns the arcsine, in radians, of x.

Parameters
xfloat | intInput value
Returns
resultfloatThe computed result

asinh

math.asinh(x)

Returns the inverse hyperbolic sine of x.

Parameters
xfloat | intInput value
Returns
resultfloatThe computed result

atan

math.atan(x)

Returns the arctangent, in radians, of x.

Parameters
xfloat | intInput value
Returns
resultfloatThe computed result

atan2

math.atan2(x, y)

Returns the arctangent of y/x, using the signs to determine the quadrant.

Parameters
xfloat | intFirst input value
yfloat | intSecond input value
Returns
resultfloatThe computed result

atanh

math.atanh(x)

Returns the inverse hyperbolic tangent of x.

Parameters
xfloat | intInput value
Returns
resultfloatThe computed result

ceil

math.ceil(x)

Returns the least integer value greater than or equal to x.

Parameters
xfloat | intInput value
Returns
resultfloatThe computed result

copysign

math.copysign(x, y)

Returns a value with the magnitude of x and the sign of y.

Parameters
xfloat | intFirst input value
yfloat | intSecond input value
Returns
resultfloatThe computed result

cos

math.cos(x)

Returns the cosine of the radian argument x.

Parameters
xfloat | intInput value
Returns
resultfloatThe computed result

cosh

math.cosh(x)

Returns the hyperbolic cosine of x.

Parameters
xfloat | intInput value
Returns
resultfloatThe computed result

degrees

math.degrees(x)

Converts angle x from radians to degrees.

Parameters
xfloat | intInput value
Returns
resultfloatThe computed result

exp

math.exp(x)

Returns e raised to the power of x.

Parameters
xfloat | intInput value
Returns
resultfloatThe computed result

fabs

math.fabs(x)

Returns the absolute value of x.

Parameters
xfloat | intInput value
Returns
resultfloatThe computed result

floor

math.floor(x)

Returns the greatest integer value less than or equal to x.

Parameters
xfloat | intInput value
Returns
resultfloatThe computed result

gamma

math.gamma(x)

Returns the Gamma function of x.

Parameters
xfloat | intInput value
Returns
resultfloatThe computed result

hypot

math.hypot(x, y)

Returns the square root of x*x + y*y.

Parameters
xfloat | intFirst input value
yfloat | intSecond input value
Returns
resultfloatThe computed result

log

math.log(x, base?)

Returns the natural logarithm of x, or the logarithm of x in the given base.

Parameters
xfloat | intValue to take the logarithm of
base?optionalfloat | intLogarithm base (default: e)
Returns
resultfloatThe logarithm of x

mod

math.mod(x, y)

Returns the floating-point remainder of x/y.

Parameters
xfloat | intFirst input value
yfloat | intSecond input value
Returns
resultfloatThe computed result

pow

math.pow(x, y)

Returns x raised to the power of y.

Parameters
xfloat | intFirst input value
yfloat | intSecond input value
Returns
resultfloatThe computed result

radians

math.radians(x)

Converts angle x from degrees to radians.

Parameters
xfloat | intInput value
Returns
resultfloatThe computed result

remainder

math.remainder(x, y)

Returns the IEEE 754 floating-point remainder of x/y.

Parameters
xfloat | intFirst input value
yfloat | intSecond input value
Returns
resultfloatThe computed result

round

math.round(x)

Returns the nearest integer, rounding half away from zero.

Parameters
xfloat | intInput value
Returns
resultfloatThe computed result

sin

math.sin(x)

Returns the sine of the radian argument x.

Parameters
xfloat | intInput value
Returns
resultfloatThe computed result

sinh

math.sinh(x)

Returns the hyperbolic sine of x.

Parameters
xfloat | intInput value
Returns
resultfloatThe computed result

sqrt

math.sqrt(x)

Returns the square root of x.

Parameters
xfloat | intInput value
Returns
resultfloatThe computed result

tan

math.tan(x)

Returns the tangent of the radian argument x.

Parameters
xfloat | intInput value
Returns
resultfloatThe computed result

tanh

math.tanh(x)

Returns the hyperbolic tangent of x.

Parameters
xfloat | intInput value
Returns
resultfloatThe computed result