Lets say I need a number to be rounded to the nearest multiple of 5, 10, 32... etc
Examples:
Multiples of 5:
0, 5, 10, 15, 20 ,25
12 would = 10
int(x/5)*5 that would be from your example int(12/5)*5 <-> int(12/5)*5 <-> int(2.4)*5 -> 2*5=10
Try it yourself with a textbox:
System| On start of layout -> Text| set text to int(12/5)*5
[quote:1s4v1dec]
Multiples of 10:
0, 10, 20 , 30, 40
16 would = 20
int(x/10)*10
[quote:1s4v1dec]
Multiples of 32:
0, 32, 64, 96, 128
89 would = 96
int(x/32)*32
[quote:1s4v1dec]
What about rounding up or down and not to nearest? As in:
Rounding down to make 14 = 10 or
Rounding up to make 11 = 15?
floor(14/10)*10
ceil(11/10)*10
[quote:1s4v1dec]
I am aware I may have to create a variable, just not sure if there is an expression for this already or if I have to take the number and put it in a formula.
Also will Round(5.5) = 5 or 6?
I have only read 5.4 = 5 and 5.6 = 6 in forum examples.
I never read what would happen if it was in the exact middle.
Does it just pick up or down randomly?
Why have you tried it yourself?
round(5.5) is 6
[quote:1s4v1dec]
How sensitive is Ceil and Floor?
would floor(5.99999) still be 5?
would ceil(5.00001) still be 5?
Same here try it yourself.
floor(5.99999) is 5
ceil(5.00001) is 6
That is what they are for.