Round

This function allow to round a number to a specific decimal

Parameters

  • number (number): The number to be rounded.
  • mode ("up", "down" or "round"): "round" is normal rounding, "up" if >.5 and "down" if <.5
  • decimal (number): number of decimal to keep

Returns

  • The rounded version of the input number

Examples

round(3.37, "down", 1)

Output: 3.0

round(1.62, "round", 0)

Output: 2

round(1.123, "up", 1)

Output: 2.0