I need a mathematical function/formula/expression to take a number as parameter and find the lowest number ending with certain digits that is larger than the parameter.
For instance, if the ending digits should be 88 these are some examples of what I want:
f(0) = 0
f(87) = 88
f(88) = 88
f(89) = 188 //NB: NOT 88*2=176
f(187) = 188
f(188) = 188
f(189) = 288
and so on. You get the idea.
So far I've used a function (in Delphi, not implemented by me) that does this:
function RoundToSpecificEndingDigits(aLength,aModMeasure : double) : double;
begin
Result := aModMeasure;
while Result < aLength do Result := Result + 100;
end;
Now I need a more "mathematical" approach with divs and mods and rounds etc. The reason is that I want to do it in SQL without creating functions.