In computer programming, I often encounter the need to give the binary operations:

  • The greatest multiple of $y$ that is not greater than $x$
    • $41 \circ_1 6 = 36$
    • $3.2 \circ_1 0.5 = 3$
  • The least multiple of $y$ that is not less than $x$
    • $41 \circ_2 7 = 42$
    • $3.2 \circ_2 0.5 = 3.5$

where $x$ and $y$ belong to the same class (such integer or float). Mathematically, it can be considered that they are both integers or both real numbers. They are somewhat reminiscent of floor and ceiling functions.

Is there such notion (and perhaps names and/or notations) like these binary operations?


If by "multiple" you mean integer multiple, then mathematically the first one is $$ \left\lfloor \frac{x}{y} \right\rfloor y $$ and the second one is $$ \left\lceil \frac{x}{y} \right\rceil y $$

Microsoft Excel at least has a name for the functions you are looking for. They are simply called FLOOR and CEILING. To acheive the results you want in Excel, you simply type:




It would seem reasonable that if Excel can do it then computer programming languages should be able to do it, but I can't find specific information.

  • $\begingroup$ So there is no simple binary operation for that? $\endgroup$
    – sawa
    Aug 15 '14 at 7:34
  • $\begingroup$ I believe you mean $\left\lfloor \frac{x}{y} \right\rfloor y$ and $\left\lceil \frac{x}{y} \right\rceil y$. $\endgroup$ Aug 15 '14 at 11:10
  • $\begingroup$ Oops. Yes. thank you Rory. $\endgroup$ Aug 15 '14 at 17:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.