round(a)
This function rounds a to the nearest integer value. The result will have the data type BigDecimal if the param a was a BigDecimal or BigInteger. Otherwise, the result will have the type Double.
If a is not a numerical value, the function returns 0.0, see examples below.
Note: Please use values type-safe. In a commercial context, values should consistently be handled as BigDecimal data types. In a scientific field, the high-precision data type Double is better suited.
Parameters
Parameter |
Description |
a |
Numerical value. |
Examples
Parameter a |
Result |
1.2 (Type: BigDecimal) |
1 |
1.5 (Type: BigDecimal) |
2 |
-2.3 (Type: BigDecimal) |
-2 |
-2.3 (Type: Double) |
-2.0 |
-2.5 (Type: BigDecimal) |
-3 |
abc (Type: String) |
0.0 |