Quantise a value to resolution
quantise
[n (number), resolution (positive_number)]
Round value to the nearest multiple of resolution.
Introduced in v2.1
|
quantise(10, 1) |
# 10 is already a multiple of 1, so returns 10 |
|
quantise(10, 1.1) |
# Returns 9.9 which is 1.1 * 9 |
|
quantise(13.3212, 0.1) |
# 13.3 |
|
quantise(13.3212, 0.2) |
# 13.4 |
|
quantise(13.3212, 0.3) |
# 13.2 |
|
quantise(13.3212, 0.5) |
# 13.5 |