Open debrouwere opened 6 years ago
Quantize to somewhere in between a magnitude.
For example:
ceil(55.25, 1.2) => 55.26
floor(55.25, 1.2) => 55.24
round(55.3333, 2.5) => 55.335
round(12.345, 1.1) == round(12.345, 2) == 12.34
Note that quantization beyond an order of magnitude results in a variable amount of decimal digits depending on the lowest common multiple.
floor(1.2341234, 1.25) == 1.225
floor(1.2341234, 1.50) == 1.20
This kind of quantization is often useful when producing charts: when the maximum value is 117K, the axis should preferably go from 0 to 120K or 0 to 125K instead.
Should support round, ceil, floor, min and max.
Quantize to somewhere in between a magnitude.
For example:
ceil(55.25, 1.2) => 55.26
floor(55.25, 1.2) => 55.24
round(55.3333, 2.5) => 55.335
round(12.345, 1.1) == round(12.345, 2) == 12.34
Note that quantization beyond an order of magnitude results in a variable amount of decimal digits depending on the lowest common multiple.
For example:
floor(1.2341234, 1.25) == 1.225
floor(1.2341234, 1.50) == 1.20