Module mathx
A module that adds helpful extensions to the math library.
Functions
floor (n, p) | Extends the math.floor function to take a number of decimal places. |
round (n, p) | Round a number to a given number of decimal places. |
patch () | Adds all the functions in this module to the 'math' table. |
Functions
- floor (n, p)
-
Extends the math.floor function to take a number of decimal places.
Parameters:
- n The number to floor
- p The number of decimal places
Returns:
-
The number n, truncated to p decimal places
- round (n, p)
-
Round a number to a given number of decimal places.
Parameters:
- n The number to round
- p The number of decimal places
Returns:
-
The number n, rounded to p decimal places
- patch ()
- Adds all the functions in this module to the 'math' table. Note that we exclude this function itself.