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

Multiples of 10:

0, 10, 20 , 30, 40

16 would = 20

Multiples of 32:

0, 32, 64, 96, 128

89 would = 96

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?

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.

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.

I saw a "%" symbol used before and wasn't sure what it meant. I didn't know int() even existed, figured that was what ceil and floor was for.. Still a bit new. 5.5 is kind of half full half empty kind of thing. Wasn't sure if there was a built in expression or not, this answers it. Thank you.

Nothing that I asked in this post can be found in the Manual. I asked for a formula or for a built in expression. It wasn't in the manual so I wasn't sure. When rounding 5.5 is in the middle and can technically be rounded up or down. Was asking if Ceil and Floor was hard limit or not. 5.9 and 5.9999 are different. One has 10% missing while the other has .0001% missing.

Int is in the manual. I didn't know the use of it at the time, so reading it and it sticking with me are two different things. I will admit I misread your post at first. I hope it didn't come across as me being a jerk.

Nothing that I asked in this post can be found in the Manual. I asked for a formula or for a built in expression. It wasn't in the manual so I wasn't sure, plus sometimes someone doesn't know how to look up what they don't know. When rounding 5.5 is in the middle and can technically be rounded up or down. Was asking if Ceil and Floor was hard limit or not. 5.9 and 5.9999 are different. One has 10% missing while the other has .0001% missing.

Sorry for the quite useless input, but rounding 5.5 will give you 6 for equity purpose

5.0;5.1;5.2;5.3;5.4 gives 5 after rounding

5.5;5.6;5.7;5.8.5.9 gives 6 after rounding

also I think int gets the integer part of a number, which is different from floor for negative numbers.

also, you shouldn't really use int on strings, it works in the case you described but this is more an "thing that happens" rather than a feature

This is what I was talking about. I believe it rounds up by 64s. Can someone explain this?

I would like to know what the "%" symbol does. I assume it has to do with percent, but in programming symbols don't always mean what they mean to normal everyday people.

To me it looks like a If-Then-Else, but each one is in a "Value" field for a "Set Value".

I didn't know this could be done.

What the above formulas are seemingly doing is rounding up to the nearest 64, and they have a built in offset.

Would "ceil(x/64)*64" be similar (except for the offset)?

Why would somebody complicate a formula like this, or am I misunderstanding the longer formula?