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 |