6.7 – Mathematical Functions

This library provides basic mathematical functions. It provides all its functions and constants inside the table math. Functions with the annotation "integer/float" give integer results for integer arguments and float results for float (or mixed) arguments. Rounding functions (math.ceil, math.floor, and math.modf) return an integer when the result fits in the range of an integer, or a float otherwise.

math.deg()
  • References/Lua/Lua/Standard Libraries/Mathematical Functions

math.deg (x) Converts the angle x from radians to degrees.

2025-01-10 15:47:30
math.maxinteger
  • References/Lua/Lua/Standard Libraries/Mathematical Functions

math.maxinteger

2025-01-10 15:47:30
math.tan()
  • References/Lua/Lua/Standard Libraries/Mathematical Functions

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

2025-01-10 15:47:30
math.pi
  • References/Lua/Lua/Standard Libraries/Mathematical Functions

math.pi The value of π.

2025-01-10 15:47:30
math.fmod()
  • References/Lua/Lua/Standard Libraries/Mathematical Functions

math.fmod (x, y) Returns the remainder of the division of x by y that rounds the quotient towards zero. (integer/float)

2025-01-10 15:47:30
math.min()
  • References/Lua/Lua/Standard Libraries/Mathematical Functions

math.min (x, ···) Returns the argument with the minimum value, according to the Lua operator <. (integer/float)

2025-01-10 15:47:30
math.ult()
  • References/Lua/Lua/Standard Libraries/Mathematical Functions

math.ult (m, n) Returns a boolean, true if and only if integer m is below integer n when they are compared as unsigned integers.

2025-01-10 15:47:30
math.max()
  • References/Lua/Lua/Standard Libraries/Mathematical Functions

math.max (x, ···) Returns the argument with the maximum value, according to the Lua operator <. (integer/float)

2025-01-10 15:47:30
math.log()
  • References/Lua/Lua/Standard Libraries/Mathematical Functions

math.log (x [, base]) Returns the logarithm of x in the given base. The default for base is e (so that the function returns the natural logarithm

2025-01-10 15:47:30
math.tointeger()
  • References/Lua/Lua/Standard Libraries/Mathematical Functions

math.tointeger (x) If the value x is convertible to an integer, returns that integer. Otherwise, returns nil.

2025-01-10 15:47:30