Math Module
The math module provides common floating-point math functions and constants.
Import
Constants
math.pireturnsfloatmath.ereturnsfloat
Unary Functions
All unary math functions take one float and return a float:
math.sqrt(x)math.sin(x)math.cos(x)math.tan(x)math.asin(x)math.acos(x)math.atan(x)math.ln(x)math.log2(x)math.log10(x)math.exp(x)math.abs(x)math.floor(x)math.ceil(x)math.round(x)
Binary Functions
All binary math functions take two float values and return a float:
math.atan2(y, x)math.log(x, base)math.min(a, b)math.max(a, b)math.hypot(a, b)math.pow(base, exp)