Round a number to the closest number which substracted from the base is a multiple of the provided interval.
This is a convenience function intended to humanize issues of floating point precision.
The interval is treated as a standard string representation to determine the amount of decimal truncation applied.
Parameters
interval: number = 1
The step interval
Optionalmethod: "round"|"floor"|"ceil" = "round"
The rounding method
Optionalbase: number = 0
The step base
Returns number
The rounded number
Example: Round a number to the nearest step interval
Round a number to the closest number which substracted from the base is a multiple of the provided interval. This is a convenience function intended to humanize issues of floating point precision. The interval is treated as a standard string representation to determine the amount of decimal truncation applied.