Math
mash.math · Utilities
Methods
Section titled “Methods”math.abs(val: mixed)
Absolute value
math.acos(val: mixed) → float
Arc cosine
math.acosh(val: mixed)
Inverse hyperbolic cosine
math.asin(val: mixed) → float
Arc sine
math.asinh(val: mixed) → float
Inverse hyperbolic sine
math.atan(val: mixed) → float
Arc tangent
math.atan2(y: mixed, x: mixed) → float
Arc tangent of two variables
math.atanh(val: mixed)
Inverse hyperbolic tangent
math.ceil(val: mixed) → float
Round up to the nearest integer
math.cos(val: mixed) → float
Cosine
math.cosh(val: mixed) → float
Hyperbolic cosine
math.exp(val: mixed) → float
Calculates e raised to the power of val
math.floor(val: mixed) → float
Round down to the nearest integer
math.isNan(val: mixed) → bool
Check if value is not a number
isNumeric
Section titled “isNumeric”math.isNumeric(val: mixed) → bool
Check if value is numeric (a number or a numeric string)
math.log(val: mixed) → float
Natural logarithm
math.max(vals?: mixed)
Find the highest value in an array, or among separate arguments: max([1, 5]) and max(1, 5)
math.min(vals?: mixed)
Find the lowest value in an array, or among separate arguments: min([1, 5]) and min(1, 5)
math.pow(x: mixed, y: mixed)
Raise x to the power of y
random
Section titled “random”math.random(min?: mixed = 0, max?: mixed = 9999999999) → int
Generate a random integer between min and max
math.round(int: mixed, precision?: mixed = 0) → float
Round a number to the given precision
math.sin(val: mixed) → float
Sine
math.sinh(val: mixed) → float
Hyperbolic sine
math.sqrt(val: mixed) → float
Square root
math.tan(val: mixed) → float
Tangent
math.tanh(val: mixed) → float
Hyperbolic tangent
toBase
Section titled “toBase”math.toBase(val: mixed, from: mixed, to: mixed) → string
Convert a number between arbitrary bases
toBinary
Section titled “toBinary”math.toBinary(val: mixed) → string
Convert a decimal number to binary
toDecimal
Section titled “toDecimal”math.toDecimal(string: Stringable, base?: int = 10)
Convert a string to a decimal number in the given base
toDegrees
Section titled “toDegrees”math.toDegrees(val: mixed) → float
Convert radians to degrees
math.toHex(val: mixed) → string
Convert a value to hexadecimal
math.toInt(val: mixed) → int
Convert a value to an integer
math.toOct(val: mixed) → string
Convert a value to octal
toRadians
Section titled “toRadians”math.toRadians(val: mixed) → float
Convert degrees to radians