This function rounds numerical value a to the nearest double value with b digits after the decimal separator. Since this function uses double values internally, rounding errors may occur. Use function round(bigdecimal a, b) to avoid this.
If a is not a numerical value, the function returns 0.0, see examples below.
Parameters
Parameter | Description |
|---|---|
a | Numerical value. |
b | Number of decimal places in resulting value. |
Examples
Parameter a | Parameter b | Result |
|---|---|---|
2.135 | 0 | 2 |
2.135 | 1 | 2.1 |
2.135 | 2 | 2.14 |
abc | 2 | 0.0 |