# Name for integer "quotient" rounded up (ceiling) instead of down (floor), and its negative or complementary "remainder"

If $$168$$ cookies (dividend) are shared between $$17$$ people (divisor), that's almost $$10$$ cookies each but we're $$2$$ cookies "short"; alternatively we have slightly more than $$9$$ cookies each (quotient) with $$15$$ "spare" cookies (remainder). Optimists have fifteen extra cookies to share out; pessimists must distribute two losses; mathematicians will note $$15 + 2 = 17$$. Optimists at least know what their fifteen cookies are called, which is maybe why they're so happy. Can we cheer the pessimists up by finding the correct nomenclature for their two-cookie deficit?

Similarly, what do we call the rounded up answer to the division, $$10 = \lceil 168 \div 17 \rceil$$? It's the smallest whole number that, when multiplied by the divisor, gives a product at least as large as the dividend. It is analogous to the standard integer quotient we get from rounding down, $$9 = \lfloor 168 \div 17 \rfloor$$, which is the largest whole number that gives a product less than or equal to the dividend. The two will coincide if the division can be performed exactly, e.g. if I hadn't raided the cookie supply beforehand, $$10 = \lceil 170 \div 17 \rceil = \lfloor 170 \div 17 \rfloor$$.

It is standard to write

$$\text{dividend} = \text{divisor} \times \text{quotient} + \text{remainder}$$

which in our case is $$168 = 17 \times 9 + 15$$, and clearly $$168 = 17 \times 10 - 2$$ is analogous. Should we view this as a remainder of $$-2$$ being added on? Certainly there are contexts, particularly computing, where things are sometimes defined so that negative remainders are acceptable — see links below. Or might we view it as the complement of the remainder (with respect to the divisor), $$2 = 17 - 15$$, and the operation as a subtraction?

This concept is clearly well-defined; given dividend $$a$$ and divisor $$n \in \mathbb{N}$$, we can choose a unique $$x, y \in \mathbb{N}\cup\{0\}$$ such that $$a = nx - y$$ instead of the usual $$a = nq + r$$, e.g. by specifying $$0 \leq y \lt n$$. In fact the two different "remainders" $$r$$ and $$y$$ don't always sum to the divisor: they are both zero if the division can be performed exactly. But that's why I'd like a name for this "anti-remainder": otherwise I'd just call it e.g. the "complement of the remainder" or "complementary remainder".

Disclaimer: I'm using "ceiling" and "floor" loosely here, and only writing in the context of division of positive integers by positive integers: here's a great answer exploring how conventions on rounding and even the sign of the remainder differ between programming languages particularly when negative integers are involved with corresponding Wikipedia article that talks about "negative remainders". But I'm particularly interested in appropriate terminology. Certainly this is something people use all the time — did anyone read the first line of my question and immediately think "well $$17 \times 9 = 153$$ and $$168 - 153 = 15$$ so it's nine cookies each and fifteen remainder", rather than being two shy of ten each? I can't believe something in such widespread use can be without a name!

Related terminology questions: is there a name for the complement of the modulo operation? and is there an official name for "divisor minus remainder"?

• A solution : allow only strictly necessary cookies. :) Mar 18 at 21:20
• I'm not sure, but you may be attracting close votes because the precise question, summarized in the title, is obscured by many tangential things in the question body. Mar 22 at 10:35
• @ronno The title's succinct yet sadly inaccurate: we don't always floor to find the "quotient" (& hence define "remainder") nor is "cookie deficit" always the remainder's complement (several Qs here asked, essentially, "what's the complement of the remainder called?" - they mostly get told "it doesn't mean what you think it means!"). Many Qs asked about negative remainders only to get told "it depends on your rounding conventions!". The tangents are there to say "yes I know all that, but there's a well-defined thing here, what's it called?" Mar 22 at 12:30
• Maybe I don't understand the question then. There are two choices each for $\text{quotient}$ and $\text{remainder}$ as functions of $(\text{dividend}, \text{divisor}) \in \mathbb{N} \times \mathbb{N}_{> 0}$: $\lfloor n/d \rfloor$, $\lceil n/d \rceil$ and $n - d\lfloor n/d \rfloor$, $d\lceil n/d \rceil - n$. Maybe you also want to allow $n - d\lceil n/d \rceil$. I suppose this produces $16$ choices for each on $\mathbb{Z} \times \mathbb{Z}^\times$ (or maybe $27$ for the remainder). You shouldn't expect each of these choices to have its own name. Maybe the original $4$ (or $6$). Mar 22 at 14:27
• The wikipedia says "Given an integer $a$ and a non-zero integer $d$, it can be shown that there exist unique integers $q$ and $r$, such that $a = qd + r$ and $0 \le r < |d|$. The number $q$ is called the quotient, while $r$ is called the remainder". "The remainder, as defined above, is called the least positive remainder or simply the remainder". So, how about calling your remainder "the greatest negative remainder"? Mar 24 at 15:28

This isn't intended as a complete and definitive answer, more a list of places I've seen this concept crop up and writers have seen fit to give it a name. Aside from elementary number theory, careful treatment of remainders and their definition is important in pedagogy and in the study of computation — certainly in specifying algorithms for use in computers, but also systems of mental arithmetic and traditional hand calculation. These are the areas I've had a look around but feel free to suggest more in the comments.

### Number theory

I liked @mathlove's suggestion that the "greatest negative remainder when we divide $$168$$ by $$17$$ is $$-2$$". Sadly Google suggests this isn't in widespread use, but it certainly has been used by professional mathematicians before. Here is Leonard Eugene Dickson in Volume II (Diophantine analysis) of his magisterial History of the Theory of Numbers, quoting from p. 68:

Let $$\rho_1$$ be the least positive remainder and -$$\rho_2$$ the greatest negative remainder when s is divided by k

Dickson's "greatest negative remainder" is like Wikipedia's definition of remainder $$a=q \times d+r$$ but relaxes the requirement $$r \ge 0$$. Interestingly he puts $$r = −\rho_2$$ so $$\rho_2 \ge 0$$. He clearly regards the positive quantity as more natural, preferring to write the equivalent of $$a=q \times d − \rho_2$$, but never gives $$\rho_2$$ a name. Since we want the remainder to be zero if we can divide exactly, we would be better to say greatest non-positive remainder.

I thought "least positive remainder" pretty unambiguous until I checked whether anyone had inverted the phrase... Peter Barlow, English mathematician and physicist, writing in the early nineteenth century, uses "least negative remainder" in this proof of the four-square theorem:

If $$A$$ be any prime number, and all the consecutive squares $$1^2, 2^2, 3^2, 4^2, \text{&c} ... \left(\frac{A-1}{2}\right)^2$$ be divided by $$A$$, they will each leave a different positive remainder ... In the same manner it is proved, that the negative remainders are all different from each other ... let $$p$$ be the least negative remainder, then $$p+1$$ must be found either amongst the positive or negative remainders...

Barlow's doesn't just mean "least in magnitude" here, he clearly views "negative remainders" as positive quantities that we have to subtract, so $$a=q' \times d - r_{neg}$$ rather than the usual $$a = q \times d + r_{pos}$$ for positive remainders. (In context, Barlow is picking the "least negative remainder" from a set of remainders for different divisions, rather than the plausible remainders you could assign to an individual division. He also knew that the remainder in this case could not be zero, but in general it might be, so for our purposes the better phrase would be least non-positive remainder. But the important thing is that he views what he calls "negative remainders" as positive, and the one nearest zero that we'd choose for a specific division is indeed the least non-negative quantity we could subtract from a suitable product to obtain the dividend.) I find it rather confusing to have a "negative remainder" that's defined to be non-negative so I understand why more modern authors don't seem to use the term this way.

I'm not sure how this terminology would extend to the corresponding quotient: a "negative quotient" would be horribly confusing, while "the quotient corresponding to the greatest [or following Barlow, least... perhaps best to say "nearest zero" to be really unambiguous!] negative remainder" is a mouthful.

#### Pedagogy

There's a huge mathematics education literature on the teaching of division with remainders, and I can't claim to have done any kind of systematic review of it. There are some surprisingly subtle concepts in play (e.g. Cooper and Karsenty, 2018 consider if there's a difference between "no remainder" and "remainder = zero", or whether "3 remainder 2" from $$17 \div 5$$ is the same "3 remainder 2" as you get from $$11 \div 3$$) but the whole body of literature I looked at stuck rigorously to the definition of "the remainder" as the least non-negative remainder. It might be more fruitful to look at the pedagogical literature on mental arithmetic strategies, where I suspect more flexibility may be shown.

There's a highly cited paper by Liljedahl, Chernoff, and Zazkis (2007) about designing investigatory tasks for schoolchildren in which "negative remainders" arise as a side-issue. Their task involved placing pentominoes on a 10x10 grid with squares labelled 1-100, and asking if the sum of the numbers covered by the pentomino is divisible by 5.

Finally, some students combined the previous renumbering of the grid with their understanding of remainder as possibly being deficit (i.e. a remainder of 3 is the same as a deficit of 2). ... The groups who came to the solution of renumbering the chart as in figure 3c had no difficulties explaining their observations pertaining to symmetry, balance, and reflective and rotational complements. This is nicely demonstrated in Angela’s comments: We noticed in the remainder zero group that there are always the same number of squares on the left as on the right. We now see that these cancel each other out because the ones on the right have a positive remainder and the ones on the left have a negative remainder.

Liljedahl, Chernoff, and Zazkis clearly distinguish:

• a negative remainder, which is consistent with the standard definition of remainder in so far as it still refers to a quantity being added on, but violates it in the sense that this quantity is below zero,
• a deficit, which is a positive quantity to be subtracted.

I find this a very reasonable terminology, but a note of caution: the paper isn't primarily concerned with division, I'm not sure that "deficit" was intended as a term of art, and I can't find much evidence of it being widely used by others. Unfortunately the nature of the task, being focused on divisibility by five and essentially nudging students into the realm of modular arithmetic, obscures the fact that switching from positive to negative "remainder" changes the "quotient" too. So in my example where I use $$168=17\times10-2$$ instead of the conventional $$168=17\times9+15$$, there'd be a "negative remainder" of $$-2$$ and a "deficit" of $$2$$, but it's unclear what Liljedahl et al. would call the $$10$$ compared to the conventional quotient of $$9$$.

#### Human computation

Fiddling around with remainders is the kind of trick that people who perform competitive mental arithmetic need to gain proficiency in, so I've tried looking about to see if they've developed a nomenclature for the technique. From a brief scan, it seems that saying "$$168 \div 17$$ makes $$10$$ remainder $$-2$$" generally wouldn't be regarded as the final, correct result, but something which requires a quick adjustment to procure $$9$$ remainder $$15$$. I've seen phrases like "interim remainder" or intermediate remainder, which make sense, with corresponding interim quotient or intermediate quotient. It's not necessarily specific to "deficits" though, as there are several ways that remainders from estimates can differ from the result of Euclidean division. Consider $$189 \div 17$$, where our first thought might be to use $$17 \times 10 = 170$$ to give us an "interim quotient" of $$10$$ and "interim remainder" of $$19$$, which we adjust to a quotient of $$11$$ and remainder of $$2$$. I find this a genuinely useful terminology, even if it doesn't quite split the cases of positive and negative remainders, and it's nice it covers quotients as well.

#### Computer science

Negative remainders are used in several programming languages, but usually not when both dividend and divisor are positive. Nevertheless, there is a CS literature on what integer division and mod functions should return over the full range of dividends and divisors, see Boute (1992) and the more easily digested Leijen (2001) — hat duly tipped to this excellent Math SE answer which contains the highlights. It transpires that several major programming languages implemented integer division incorrectly, while many others use a definition based on truncation (rounding towards zero) which Boute and Leijen disapprove. They prefer Knuth's suggestion based on flooring (rounding towards $$-\infty$$, which has some nice properties e.g. the signs of dividend and divisor can be reconstructed if given the signs of quotient and remainder), or better still but very rarely seen, Euclidean division. These three options are compared in some depth, but all give non-negative remainders when dividend and quotient are both positive so neither Boute nor Leijen focus on this case. But they briefly mention a fourth convention, based on rounding to the nearest integer, which can give negative remainders when dividend and divisor are positive. All these conventions fit Boute's generalised definition of quotient $$D \text{ div } d$$ and remainder $$D \text{ mod } d$$, for dividend $$D$$ and divisor $$d \neq 0$$:

Presently, we require that the functions $$\text{div}$$ and $$\text{mod}$$ at least satisfy the following conditions:

• (a) $$D \text{ div } d \in \mathbb Z$$ (integer quotient must be integer),
• (b) $$D = d \cdot (D \text{ div } d) + D \text{ mod } d$$ (division rule),
• (c) $$|D \text{ mod } d| < |d|$$ ($$|remainder| < |divisor|$$),

in addition to the implicit basic condition that, if $$D/d \in \mathbb Z$$, then $$D \text{ div } d = D/d$$.

This gives a more general framework for talking about quotients and remainders, and in principle allows remainders to be negative. It doesn't equip us with language to disambiguate the different answers for quotient or remainder we would get — this framework doesn't contrast "deficits" versus "genuine remainders", for example — other than to specify which convention we used. Leijen suggests the following names for the common "div-dominant" conventions, i.e. cases where we first define the quotient as a function of $$D/d \in \mathbb R$$ and the remainder follows from $$D \text{ mod } d = D - d \cdot (D \text { div } d)$$:

• T-division: $$D \text{ div } d = \operatorname{trunc}(D/d)$$ (truncates towards zero),
• F-division: $$D \text{ div } d = \lfloor D/d \rfloor$$ (floor, rounds towards $$+\infty$$),
• R-division: $$D \text{ div } d = \operatorname{round}(D/d)$$ (rounds to nearest integer),
• C-division: $$D \text{ div } d = \lceil D/d \rceil$$ (ceiling, rounds towards $$-\infty$$).

Boute uses similar terminology but e.g. "T-definition" rather than "T-division", etc. In contrast, Euclidean division is a "mod-dominant" convention, since we begin by specifying that the remainder is the unique $$0 \leq D \text{ mod } d < d$$, and the value of the quotient follows from this requirement. Leijen calls this E-division, but mathematicians will view this as just the "standard" definition of integer division.

Neither Boute nor Leijen mention the possibility, but their framework would also permit a "deficit-centric" definition of division, with the mod-dominant requirement $$-d < D \text{ mod } d \le 0$$ guaranteeing a non-positive remainder. Under this convention, for $$168 \div 17$$, the quotient is $$10$$ and the remainder is $$-2$$, and we would obtain the same answers from C-division and R-division (since $$168/17 = 9.88...$$ which rounds to $$10$$). However, the quotient is $$9$$ and the remainder is $$15$$ if we use T-division, F-division, or E-division. For the computer scientist, it seems both sets of answers represent bona fide quotients and remainders. Euclidean division, perhaps regrettably as Boute and Leijen would argue, does not enjoy an elevated position that others are judged against. In fact a remainder function was defined as part of the standard IEEE 854-1987, and hence subsequently incorporated into more recent versions of the IEEE Standard for Floating-Point Arithmetic (IEEE 754), and it's not E-division:

When $$y \neq 0$$, the remainder $$r = x\text{ REM }y$$ is defined regardless of the rounding mode by the mathematical relation $$r = x - y \times n$$, where $$n$$ is the integer nearest the exact value $$x/y$$; whenever $$|n-x/y| = \frac{1}{2}$$, then $$n$$ is even.

This is what Leijen calls R-division, with "bankers' rounding". REM has a more apt name than the traditional mod function: as Cox (2007) complains, mod returns the remainder or residue, and not the modulus (which in this context refers to the divisor). Cody et al. (1985) justify REM on numerical grounds:

REM is defined as it is, instead of matching the "mod" function found in many programming languages, because the latter can always be computed from the former, but the converse is not always true. This is so because REM's remainder is the smallest possible remainder in magnitude, and is always exact. Note in the definition of remainder that the integer $$n$$ may not be exactly representable in the precision of $$x$$, $$y$$, and $$r$$ because of inadequate precision, exponent range, or both. Nevertheless, $$r$$ is exactly representable in the precision of $$x$$ and $$y$$.

Mathematically, different definitions of remainders are essentially interchangeable, as converting between them just involves adding or subtracting the divisor. But in computing, convertibility can be lost if numerical precision is lost: the virtue of choosing the smallest possible remainder in magnitude is that storing a larger number can result in such loss of precision. Boute believes floating point precision should be a lower priority than mathematical meaningfulness, particularly over integers; he points out that the remainder being exactly representable in the precision of the divisor and dividend is at any rate a property

...inherited by all definitions of mod that satisfy the division rule and whose range is not larger than the range of REM because, as explained in Cody [et al., 1985] such mod functions can always be computed from the REM function without loss in precision. The range of REM is $$[-|d|/2, +|d|/2]$$, and the range of the Euclidean mod, being $$[0, |d|)$$, is never larger.

And so we reach a conclusion that might surprise a student of mathematics and irritate Boute: the IEEE-compliant answer to $$168 \div 17$$ really is a quotient of $$10$$ and a remainder of $$-2$$. Contrary to the premise of this Math SE question, it is the "quotient" of $$9$$ and "remainder" of $$15$$ that are anomalous, or at least non-compliant. But we might find it useful to distinguish REM returning $$-2$$ from mod returning $$15$$. If necessary we can disambiguate further by specifying which division algorithm was used: Boute and Leijen provide a helpful lexicon with E-division, F-division, etc., but in words "Euclidean division" or "divide and floor" will be more universally understood.

I'm not aware that the IEEE standards make a REM/mod type distinction for the quotient but the standard is actually paywalled so I haven't read it in full! There is an international version, jointly published by the International Electrotechnical Commission and International Organization for Standardization as ISO/IEC 60559:2020, identical to the most recent IEEE 754-2019. There is another standard, ISO/IEC 10967, Language independent arithmetic (LIA), whose current version is designed to be compatible with IEEE 754-2008 (the most recent version is now IEEE 754-2019, which among other things fixes an error in how minimum and maximum were defined in IEEE 754-2008). This comes in three parts, LIA-1 to LIA-3, with PDFs freely available for download. Their most recent editions are ISO/IEC 10967-1:2012, Integer and floating point arithmetic; ISO/IEC 10967-2:2001, Elementary numerical functions; and ISO/IEC 10967-3:2006, Complex integer and floating point arithmetic and complex elementary numerical functions. If you thought negative remainders were fun, LIA-3 extends integer division and remainder to the imaginary and complex integers in Section 5.1.2.8, page 22. But I shall stick with LIA-1 and 2, both of which discuss appropriate nomenclature for integer division and its remainder. Much of the technical detail is devoted to identifying problems like overflows or assigning the correct sign to $$\pm 0$$, and takes place in the set $$I$$ of integers or $$F$$ of floating point numbers which the computer's arithmetic system is able to represent. When I cite definitions from LIA-1 and 2, I am generally going to write $$\mathbb{Z}$$ rather than $$I$$ and $$\mathbb{R}$$ rather than $$F$$, and also ignore the "helper functions" the standards use to e.g. identify overflow issues or find the nearest floating-point number.

The 1994 edition of LIA-1 defines two kinds of integer division: $$div_I^t$$ is called truncating division (rounds toward zero) and $$div_I^f$$ is called flooring division (rounds toward $$-\infty$$), with corresponding "remainder after division" $$rem_I^t$$ and $$rem_I^f$$. Either pair satisfies $$x = div_I(x,y)\times y + rem_I(x,y)$$ and $$0 \leq | rem_I(x,y) | < |y|$$ for $$y \neq 0$$. Flooring division is preferred over truncating division because:

Integer division is frequently used for grouping. For example, if a series of indexed items are to be partitioned into groups of $$N$$ items, it is natura1 to put item $$i$$ into group $$div_I(i, N)$$. This works fine if $$div_I^f$$ is used for $$div_I$$. However if $$div_I^t$$ is used, and $$i$$ can be negative, group $$0$$ will get $$2N - 1$$ items rather than the desired $$N$$. This uneven behavior for negative $$i$$ can cause subtle program errors, and is a strong reason for preferring the use of $$div_I^f$$.

In the 2012 update to LIA-1, truncating division was removed entirely due to risk of erroneous use, and flooring division was given new symbols $$quot_I(x,y) = \lfloor x/y \rfloor$$ for the quotient (replacing $$div_I^f$$) and $$mod_I$$ for the remainder (replacing $$rem_I^f$$). We then have $$x = quot_I(x,y) \times y + mod_I(x, y)$$ for $$y \neq 0$$, with $$y < mod_I(x,y) \leq 0$$ for negative $$y$$ and $$0 \leq mod_I(x,y) < y$$ for positive $$y$$. Note that $$mod_I$$ has a wider range than REM as defined in IEEE 754 (which causes the precision problem the IEEE were trying to avoid), so calling it mod rather than REM helps brings the ISO/IEC into line with the IEEE's distinction between mod and REM. LIA-2 calls this integer division with floor (the 2012 update to LIA-1 expunged the phrase "flooring division", presumably because it no longer needed to be contrasted with the banished "truncating division"). LIA-1 claims that mathematicians prefer this form of division, but as Boute and Leijen show that isn't really true: they prefer Euclidean division, which happens to agree with division with floor over the positive integers, but not on all of $$\mathbb Z$$.

LIA-2 also defines integer division with round, with the quotient perhaps confusingly denoted as the ratio, $$ratio_I(x,y) = round(x/y)$$. The associated remainder $$residue_I(x,y) = x - (round(x/y) \times y)$$ is called the residue. The subscript $$I$$ denotes this is only defined for $$x, y \in \mathbb{Z}$$, but this is the only integer division for which LIA-2 also gives a floating point version of the remainder: $$residue_F(x,y) = x - round(x,y)\times y$$ for $$x, y \in \mathbb R$$. Since this is identical to the REM in IEEE 754, LIA-2 calls this the IEEE remainder. Whether over $$\mathbb R$$ or $$\mathbb Z$$, we have the desired $$x = ratio(x,y) \times y + residue(x, y)$$.

The other integer division defined in LIA-2 is division and ceiling, denoted $$group_I(x,y) = \lceil x/y \rceil$$ with $$pad_I = (\lceil x/y \rceil \times y) - x$$. Watch the signs! This has been defined so that $$x = group_I(x, y) \times y − pad_I(x, y)$$. Here the ISO/IEC return to the "integer division as grouping" analogy which persuaded them to dump truncated division:

$$pad_I$$ returns the negative of the remainder after division and ceiling. The reason for this is twofold: 1) for unsigned integer datatypes the remainder is $$\le 0$$, and would thus often not be representable unless negated, and 2) it is intuitively easier to think of the places left in the last unfilled group of equi-sized and packed groups" as a positive entity, a padding.

The issue of whether we should negate a remainder to make it positive has been a running theme throughout this answer; for software working with unsigned integers (the equivalent of a mathematician working in $$\mathbb N \cup \{0\}$$) where division with ceiling is guaranteed to leave a non-positive remainder that lies outside the set we are working with, there is a compelling case for negating to produce a non-negative quantity we can represent in our original number system. And the proposed intuition is similar to the deficit idea in Liljedahl et al. Beware: the justification given in LIA-2 might fool you into thinking that the remainder from division with ceiling is always positive, and hence the padding is positive for any $$x, y \in \mathbb Z$$. But as Boute points out, you need a mod-dominant definition of integer division (such as Euclidean division) for that, whereas all the definitions in ISO/IEC 10967 are div-dominant and hence each produces negative remainders in certain circumstances. LIA-2 lists some rules the signs of the variously defined remainders follow:

• $$quot_I(x, y) = −group_I(−x, y)$$,
• $$quot_I(x, y) = −group_I(x, −y)$$,
• $$ratio_I(x, y) = −ratio_I(−x, y)$$,
• $$ratio_I(x, y) = −ratio_I(x, −y)$$,
• $$mod_I(x, y) = −pad_I(x, −y)$$, and
• $$residue_I(x, y) = residue_I(x, −y)$$.

Moreover, for any $$n \in \mathbb Z$$, we are given the following useful results:

• $$quot_I(x + ny, y) = quot_I(x, y) + n$$,
• $$ratio_I(x + 2ny, y) = ratio_I(x, y) + 2n$$,
• $$group_I(x + ny, y) = group_I(x, y) + n$$,
• $$mod_I(x + ny, y) = mod_I(x, y)$$,
• $$residue_I(x + 2ny, y) = residue_I(x, y)$$, and
• $$pad_I(x + ny, y) = pad_I(x, y)$$.

Note that the $$div^t_I$$ and $$rem^t_I$$ from LIA-1 do not fulfill similar useful equalities, due to the disruption around $$0$$ for this pair of operations.

This recalls Boute's critique of division with truncation; note the $$2n$$ rather than $$n$$ that was used with $$group_I$$ and $$residue_I$$ due to the issue of tie-breaking division with rounding. Where does that leave us with our original question?

If we adopt the terminology of ISO/IEC 10967, including its older versions, then we might say $$168 \div 17$$ using truncating division gives a quotient of $$9$$ and remainder $$15$$. Note that truncating division was previously discouraged and now removed from the standard.

If we use flooring division or division with floor, we might say the same again, or perhaps (though Cox would remind us it is an abuse of mathematical notation) refer to the $$15$$ as the mod.

If we use division with ceiling (also called division and ceiling at other points in LIA-2), we obtain $$10$$ groups with a padding of (positive) $$2$$. "Groups" and "padding" doesn't feel such a good fit for the cookies example, but the idea is to imagine the cookies being presented on plates such that each person can take one cookie from each plate, with a problem arising on the tenth plate where the positions of two cookies would have to be filled by placeholders. (I prefer Liljedahl et al.'s "deficit" to "padding", but I suppose "padding" may make more conceptual sense in many computer science applications.)

On the other hand, if we use division with rounding or division and round to integer, we obtain a ratio of $$10$$ and a residue or IEEE remainder of $$-2$$. I'm not a fan of this notation as I see no compelling connection between the word "ratio" and rounding to an integer — after all, what are the rational numbers? Analogously to "IEEE remainder", I'd be more tempted to call it the "IEEE quotient", personally.

#### References

Barlow, T. Demonstration of a theorem in the Diophantine analysis. Article XIX, p. 70 in Part II of Leybourn, T. (Ed.) New Series of the Mathematical Repository, Volume II. Reprinted 1809 by W. Glendinning: Hatton Garden, London. Available at https://archive.org/details/newseriesmathem04leybgoog/page/n5/mode/2up?view=theater

Boute, R. T. (1992). The Euclidean definition of the functions div and mod. ACM Transactions on Programming Languages and Systems (TOPLAS), 14(2), 127-144.

Cody, W. J., Coonen, J. T., Gay, D. M., Hanson, K., Hough, D., Kahan, W., Karpinski, R., Palmer, J., Ris, F.N. and Stevenson, D. (1985). A proposed radix-and word-length-independent standard for floating-point arithmetic. ACM SIGNUM Newsletter, 20(1), 37-51.

Cooper, J., & Karsenty, R. (2018). Can teachers and mathematicians communicate productively? The case of division with remainder. Journal of Mathematics Teacher Education, 21, 237-261.

Cox, N. J. (2007). Stata tip 43: Remainders, selections, sequences, extractions: Uses of the modulus. The Stata Journal, 7(1), 143-145.

Dickson, Leonard Eugene (2005) , History of the theory of numbers. Vol. II: Diophantine analysis, New York: Dover Publications, ISBN 978-0-486-44233-4

Leijen, D. (2001). Division and modulus for computer scientists. Available at Microsoft Research: https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/divmodnote-letter.pdf

Liljedahl, P., Chernoff, E., & Zazkis, R. (2007). Interweaving mathematics and pedagogy in task design: A tale of one task. Journal of Mathematics Teacher Education, 10, 239-249.

• If we want $\,d\bmod d = 0\,$ (vs. $\,d)$ then "least positive remainder" should be "least nonnegative remainder" (except in French where $\,0\,$ is positive and negative). It is unfortunate the Wikipedia propagates this widespread error. It's best not to propagate it further (but surely worth mention in the answer). Mar 31 at 20:11
• @BillDubuque Great point, hopefully I have addressed this now! (There was an interesting suggestion in Cooper & Karsenty where they gave a third possibility: if it divides exactly, we should at least consider the possibility there is "no remainder" rather than "zero remainder", but that would be inconvenient for anyone who wants to use a mod function! I suppose that must be how the Greeks thought about remainders, when they were having to work without the number zero.) Mar 31 at 20:37

As per the OP's suggestion, I will turn my comment into an answer.

The wikipedia says "Given an integer $$a$$ and a non-zero integer $$d$$, it can be shown that there exist unique integers $$q$$ and $$r$$, such that $$a=qd+r$$ and $$0\le r<|d|$$. The number $$q$$ is called the quotient, while $$r$$ is called the remainder". "The remainder, as defined above, is called the least positive remainder or simply the remainder". So, how about calling your remainder "the greatest negative remainder"?

• Do you also have a name for the "ceiling quotient"? Mar 30 at 12:01
• @Sambo : I don't know of a name for the "ceiling quotient", but the wikipedia says "The quotient is also less commonly defined as the greatest whole number of times a divisor may be subtracted from a dividend—before making the remainder negative". So, the "ceiling quotient" can be defined as "the least whole number of times a divisor may be subtracted from a dividend— after making the remainder negative". Mar 30 at 14:07
• @Sambo The paper by Leijen cited in my answer calls the "divide and take ceiling" algorithm C-division. So I suppose you could call it a "C-quotient" or indeed "ceiling quotient"! Whether anyone would understand you is a different matter... I think saying "the result of dividing and round up" or "rounded-up quotient" would be clear when dealing with positive quantities. I definitely saw more attention given to naming variants of the remainder rather than the corresponding quotient; if the negative remainder is seen as "not finished yet" then "interim" or "intermediate" quotient make sense Mar 31 at 0:35
• @Sambo I have now updated my answer to include ISO/IEC 10967 which is the first place I've seen a really clear name given to this operation and its outcome: the result of "division and ceiling" is described as the "groups" and "padding"(!) I can't say I'm a fan of that nomenclature, but it is apparently an internationally defined standard... Mar 31 at 19:16