function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Irvine DelacroixIrvine Delacroix 

Need help with Calculation round up to nearest 15.

Hello,

I need help on some calculation for my trigger.

Basically, what I would like to do is to get value like if the Result is 16, then this will round to 30, if it's 24 then it will still be 30, if the value is 32 then it will be 45.

What I did was :

integer x = 32;
double y = doubleValueOf(x - math.mod(x)) + 15;

But this doesn't seem to be consistent. Can I have some other sure approach to achieve this?


Thanks

Best Answer chosen by Irvine Delacroix
FearNoneFearNone
hi,
this could be done in a simple math manipulation
 y = x + 14 - (math.mod(x + 14,15));