Suppose I have a number $x$, and I want to round $x$ up to the next multiple of $y$ if $x$ isn't already divisible by $y$.
I tried $x + y - (x \mod y)$, but this fails when $x$ is already divisible by $y$. e.g., if $x = 6$ and $y = 3$, then $x + y - (x \mod y) = 9$, but I need it to be $6$ in this situation.
Is there a one line expression that can achieve what I want?
I would like to avoid dealing with non-integers and so do not want to use ceiling and floor functions. I think I would like to restrict the operations to *,/,-,+ and modulo.