Skip to content

math

The math module contains functions for common mathematical operations. ## Functions

floor(n)

Returns the smallest integer value less than or equal to n.

math::floor(42.9) == 42

Returns an int

ceil(n)

Returns the largest integer value greater than or equal to n.

math::ceil(41.1) == 42

Returns an int

round(n)

Returns the integer nearest to.

math::round(41.4) == 41
math::round(41.5) == 42

Returns an int

trunc(n)

Returns the integer part of n.

math::trunc(41.4) == 41
math::trunc(41.5) == 41

Returns an int

max(n1, n2)

Returns the maximum of two numbers.

math::max(41, 42) == 42

Returns a number (int or float)

min(n1, n2)

Returns the minimum of two numbers.

math::min(41, 42) == 41

Returns a number (int or float)