How do I round a number to the nearest multiple of 8? I know that there is a round function, but that rounds to the nearest integer, I want to round to the nearest multiple of 8.
Do something like this:
Change the number to number - mod(number, 8)
1 Like
Another way could be:
Number = floor(Number/8)*8
With the floor function you get the integer rounded down of the Number/8, then you multiply it by 8 again.
Lets say your number is 97, 97/8=12.125. With floor you take 12. 12*8 = 96, so number is now a multiple of 8.
You may use the round function if you want any number over x.4~ to be round to the upper integer.
I hope it helps.
4 Likes