Is there a name for ceiling (x / y)?

54 Views Asked by At

The integer portion of a quotient, i.e. floor (x / y), is sometimes referred to as "quotient" (e.g. Haskell defines a quot function).

Is there a name for ceiling (x / y)?

For example, given x items and containers of size y, the number of containers needed to hold the items is ceiling (x / y). Is there a name for this?

2

There are 2 best solutions below

2
On

The reason $\mathrm{floor}(x/y)$ can be considered as a "quotient" function (when $x,y>0$) is because it corresponds precisely to the quotient in Euclidean division, i.e. which integer $q$ do we multiply by $y$ such that $a=qy+r$ for some remainder $0\leq r < y$. Many programming languages offer such a function for integer division because computationally, it's cheaper than using floating-point arithmetic to divide and then round the result. For instance, in Python you would do:

>>> 5 // 2
2

$\mathrm{ceil}(x/y)$ is less used, and anyway it's equal to $\mathrm{floor}(x/y)+1$ when $x,y>0$ (edit: and $x/y$ is not an integer, as pointed out by Hans in the comments), which is probably why there's no need to give it a distinct name.

0
On

You can notice that $$ \left\lceil\frac xy\right\rceil = -\left\lfloor\frac{-x}{y}\right\rfloor $$ so there's no need to define another function when you have already defined quotient.