Description Usage Arguments Value See Also Examples
Rounds a number to the specified order. Round half away from zero (this is the difference from built-in round
function.)
1 |
x |
number to be rounded |
order |
0 (default) = units, -1 = 0.1, +1 = 10 |
rounded number to the specified order
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | round2(23.5) # = 24, compare: round(23.5) = 24
round2(23.4) # = 23
round2(24.5) # = 25, compare: round(24.5) = 24
round2(-23.5) # = -24, compare: round(-23.5) = -24
round2(-23.4) # = -23
round2(-24.5) # = -25, compare: round(-24.5) = -24
round2(123.456, -1) # 123.5
round2(123.456, -2) # 123.46
round2(123.456, 1) # 120
round2(123.456, 2) # 100
round2(123.456, 3) # 0
round2(-123.456, -1) # -123.5
round2(-123.456, -2) # -123.46
round2(-123.456, 1) # -120
round2(-123.456, 2) # -100
round2(-123.456, 3) # 0
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.