Skip to content

mathlib

abs

function math.abs(x: <Number:number>)
  -> <Number:number>

Returns the absolute value of x.

View documents

acos

function math.acos(x: number)
  -> number

Returns the arc cosine of x (in radians).

View documents

asin

function math.asin(x: number)
  -> number

Returns the arc sine of x (in radians).

View documents

atan

function math.atan(y: number, x?: number)
  -> number

Returns the arc tangent of y/x (in radians).

View documents

atan2

function math.atan2(y: number, x: number)
  -> number

Returns the arc tangent of y/x (in radians).

View documents

ceil

function math.ceil(x: number)
  -> integer

Returns the smallest integral value larger than or equal to x.

View documents

cos

function math.cos(x: number)
  -> number

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

View documents

cosh

function math.cosh(x: number)
  -> number

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

View documents

deg

function math.deg(x: number)
  -> number

Converts the angle x from radians to degrees.

View documents

exp

function math.exp(x: number)
  -> number

Returns the value e^x (where e is the base of natural logarithms).

View documents

floor

function math.floor(x: number)
  -> integer

Returns the largest integral value smaller than or equal to x.

View documents

fmod

function math.fmod(x: number, y: number)
  -> number

Returns the remainder of the division of x by y that rounds the quotient towards zero.

View documents

frexp

function math.frexp(x: number)
  -> m: number
  2. e: number

Decompose x into tails and exponents. Returns m and e such that x = m * (2 ^ e), e is an integer and the absolute value of m is in the range [0.5, 1) (or zero when x is zero).

View documents

huge

number

A value larger than any other numeric value.

View documents

ldexp

function math.ldexp(m: number, e: number)
  -> number

Returns m * (2 ^ e) .

View documents

log

function math.log(x: number, base?: integer)
  -> number

Returns the logarithm of x in the given base.

View documents

log10

function math.log10(x: number)
  -> number

Returns the base-10 logarithm of x.

View documents

max

function math.max(x: <Number:number>, ...<Number:number>)
  -> <Number:number>

Returns the argument with the maximum value, according to the Lua operator <.

View documents

maxinteger

integer

Miss locale

View documents

min

function math.min(x: <Number:number>, ...<Number:number>)
  -> <Number:number>

Returns the argument with the minimum value, according to the Lua operator <.

View documents

mininteger

integer

Miss locale

View documents

modf

function math.modf(x: number)
  -> integer
  2. number

Returns the integral part of x and the fractional part of x.

View documents

pi

number

The value of π.

View documents

pow

function math.pow(x: number, y: number)
  -> number

Returns x ^ y .

View documents

rad

function math.rad(x: number)
  -> number

Converts the angle x from degrees to radians.

View documents

random

function math.random(m: integer, n: integer)
  -> integer
  • math.random(): Returns a float in the range [0,1).
  • math.random(n): Returns a integer in the range [1, n].
  • math.random(m, n): Returns a integer in the range [m, n].

View documents

randomseed

function math.randomseed(x?: integer, y?: integer)
  • math.randomseed(x, y): Concatenate x and y into a 128-bit seed to reinitialize the pseudo-random generator.
  • math.randomseed(x): Equate to math.randomseed(x, 0) .
  • math.randomseed(): Generates a seed with a weak attempt for randomness.

View documents

sin

function math.sin(x: number)
  -> number

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

View documents

sinh

function math.sinh(x: number)
  -> number

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

View documents

sqrt

function math.sqrt(x: number)
  -> number

Returns the square root of x.

View documents

tan

function math.tan(x: number)
  -> number

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

View documents

tanh

function math.tanh(x: number)
  -> number

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

View documents

tointeger

function math.tointeger(x: any)
  -> integer?

Miss locale

View documents

type

function math.type(x: any)
  -> "float"|"integer"|'nil'

Miss locale

View documents

return #1:
    | "integer"
    | "float"
    | 'nil'

ult

function math.ult(m: integer, n: integer)
  -> boolean

Miss locale

View documents