Round a scalar or series to N digits.
ROUNDN(s, N, "option")
s |
- |
A series or scalar value. |
||||||
N |
- |
An integer, the number of decimal places to round. If negative, specifies the number of digits to the left of the decimal place. Defaults to 0. |
||||||
"option" |
- |
Optional. A string, the digit option:
|
A scalar or series, the rounded values.
W1: {6.718, 13.382, 0.556, -1.123}
W2: round(w1)
W3: roundn(w1, 0)
W4: roundn(w1, 1)
W2 == {7, 13, 1, -1}
W3 == {7, 13, 1, -1}
W4 == {6.7, 13.4, 0.6, -1.1}
Both W2 and W2 round the values to no decimal places.
W4 rounds the values to 1 decimal place.
W1: {671.8, 1338.2, 55.6, -112.3}
W2: roundn(w1, -1)
W3: roundn(w1, -2)
W4: roundn(w1, -3)
W2 == {670, 1340, 60, -110}
W3 == {700, 1300, 100, -100}
W4 == {1000, 1000, 0, 0}
W2 rounds the values left one place.
W3 rounds the values left two places.
W4 rounds the values left three places.
W1: {671.8, 1338.2, 55.6, -112.3}
W2: roundn(w1, 1, "significant")
W3: roundn(w1, 2, "significant")
W4: roundn(w1, 3, "significant")
W2 == {700, 1000, 60, -100}
W3 == {670, 1300, 56, -110}
W4 == {672, 1340, 56.6, -112}
W2 rounds the values to one significant digit.
W3 rounds the values to two significant digits.
W4 rounds the values to three significant digits.
ROUNDN rounds values to N decimal places.
If option is "significant", the values are rounded to N significant figures.