does anybody have a good strategy to find the high...

# announcementsg

groostav

03/07/2017, 7:32 PMdoes anybody have a good strategy to find the highest value less than an arbitrary number but that is evenly divided by a modulo?
eg, if

`size`

is 32, and our `modulo`

is 5, then I want a function that gives back 30 (30 is the largest number less than 32 that is divided by 5 evenly)
eg2: if `size`

is 25, and our `modulo`

is 5, then I want 25
eg3: if `size`

is 3, and our `modulo`

is 5, then I want 0
I think `floor(size / modulo) * modulo`

is as good as it gets but I'm afraid some rounding errors might burn me here for particular numbers