I'm looking for an equation to calculate the lowest multiple of any value $n$ greater than or equal to a given threshold, $y$. I've come up with a solution that works, but it's rather ugly and not incredibly efficient. I'll be using this within software, so efficiency matters to some degree.
Here's what I've come up with:
$x$ = $y$ (mod $n$) and $1$
x = 0 if y (mod n) = 0, otherwise 1
$m$ = $x(n(floor(y/n)+1)-y)+y$
This only needs to work for positive values of $y$ and $n$. Any suggestions would be greatly appreciated.