Reference > Methods
roundNearestUp(value,bucketSize)
Definition
Number roundNearestUp(Number value, Number bucketSize)
Description
Given the value and the bucket size, returns a Long that rounds UP to the closest multiple of the bucket size.
Parameter Definition
Name |
Type |
Description |
value |
Number |
Number to round |
bucketSize |
Number |
multiple, aka, bucket size to round to |
Examples
| Integer r1 = roundNearestUp(0,10); // r1 == 0
Integer r2 = roundNearestUp(3,10); // r2 == 10
Integer r3 = roundNearestUp(7,10); // r3 == 10
Integer r4 = roundNearestUp(14,10); // r4 == 20
Integer r5 = roundNearestUp(19,10); // r5 == 20
Integer r6 = roundNearestUp(20,10); // r6 == 20
Integer r7 = roundNearestUp(21,10); // r7 == 30
Integer r8 = roundNearestUp(239,60); // r8 == 240
Integer r9 = roundNearestUp(240,60); // r9 == 240
Integer r10 = roundNearestUp(241,60); // r10 == 300
|