First of all I'm not sure if "multiple" is the right term to use in my question. But here is my situation. I am building a shop that accepts orders by quarters of 1/4(.25) or 1/2(.5), like buying 1.5kg of rice or 1/4kg of garlic, etc. Now, when someone places an order, how do I correctly check if the quantity that he input is a multiple of that quarter.
So, for example I only accept orders by 1/4 (.25 in decimal), the input and result should be the ff:
.5 (good)
.75 (good)
1.25 (good)
.8 (bad)
1.33 (bad)
Right now, I just divide the input by the quarter. Then, if the answer is a whole number, it's considered good.
Is it the right way to do it?
Thanks!