Module math

Additions to the math module.

Functions

floor (n, p) Extend math.floor to take the number of decimal places.
round (n, p) Round a number to a given number of decimal places


Functions

floor (n, p)
Extend math.floor to take the number of decimal places.

Parameters

  • n: number
  • p: number of decimal places to truncate to (default: 0)

Return value:

n truncated to p decimal places
round (n, p)
Round a number to a given number of decimal places

Parameters

  • n: number
  • p: number of decimal places to round to (default: 0)

Return value:

n rounded to p decimal places

Valid XHTML 1.0!