15

The integer division is a common and useful operation in Computer Science. It comes up in many domains, as in the manipulation of matrices and grids.

Is there any formal symbol for this operation? Or at least a widely recognisable symbol that can be easily differentiated from the standard division (i.e. inverse of multiplication)?

Daniel Fischer
  • 206,697
  • I've seen a couple notations, including $a div b$ and $a/b$. If $a$ and $b$ are defined to be ints in a program, then $a/b$ is understood to be integer division rather than get some decimal number. – JasonM Jul 14 '16 at 07:51
  • Wikipedia says "Names and symbols used for integer division include div, /, , and %. Definitions vary regarding integer division when the dividend or the divisor is negative" so you should probably chose one and define it explicitly – Henry Jul 14 '16 at 07:51
  • 5
    You can use $\lfloor{a/b}\rfloor$ or $(a-a\bmod{b})/b$. – barak manos Jul 14 '16 at 08:25
  • @barakmanos Your first suggestion is good, but the second just moves the pole further, as you would then need to define mod, which, similarly to integer division is well-known, but not fully formalized yet. – Andrei Mar 02 '20 at 14:18
  • Both Python and SageMath use the notation a//b for integer division, so $a\mathbin{/!/}b$ might be another alternative, in particular if you use $a\mathbin{%}b$ for the remainder. – Christoph Mar 02 '20 at 14:24

2 Answers2

6

$\lfloor a/b \rfloor$ is probably the only formal way to express this, without creating new definitions. (The notation $\lfloor x \rfloor$ means floor(x).)

Alternatively, you could explicitly define a symbol to do the integer division operation. The common ones are \ (backslash, as opposed to / forward slash used for regular division), or div.

The advantages of using $\lfloor a/b \rfloor$ are that:

  1. you don't need a new definition
  2. you can equally succinctly express ceil(a/b) - namely as $\lceil a/b \rceil$ - if you need to, as you often do for various indexing problems
Andrei
  • 206
1

I often use $\text{div}$, which is complementary with $\text{mod}$.

There are many alternatives (some used in programming languages) such as $/,//,\backslash,\div,\%$ but these don't go without saying.

Also $\left\lfloor\dfrac\cdot\cdot\right\rfloor$.