Reference > Methods
round(value,precision)
Definition
Double round(Number value, Number precision)
Description
Returns the closest Long given the value and the number of decimals to keep.
Parameter Definition
Name |
Type |
Description |
value |
Number |
Value to round |
precision |
Number |
|
Examples
| Double r1 = round(123.14159D,0); // r1 == 123.0
Double r2 = round(123.14159D,1); // r2 == 123.1
Double r3 = round(123.14159D,2); // r3 == 123.14
Double r4 = round(123.14159D,3); // r4 == 123.142
Double r5 = round(123.14159D,-1); // r5 == 120.0
Double r6 = round(123.14159D,-2); // r6 == 100.0
Object r7 = round(123.14159D,null); // r7 == null
Object r8 = round(null,null); // r8 == null
|