In calendrical calculations, we frequently use an operation call *integer division.*

Ordinarily we would say that, for example, 14 divided by 5 is 2.8. But when we use integer division, we discard the decimal fraction and simply state that 14 divided by 5 is 2.

We indicate that we use integer division by enclosing the division between the symbols and , for example thus:

14/5 = 2

or thus:

= 2

When we perform integer division, the division leaves a remainder. In the case of 14 divided by 5, the remainder is 4: We can subtract 5 twice from 14, and this leaves us with 4.

We use the mathematical operator ‘mod’ to indicate the remainder. This is known as
the *modulo* operator. We therefore have:

14 mod 5 = 4

If you want to use integer division in computer programs, you must realize that different programs use different notations for the operations. The following table shows how integer division and the modulo operator may be written:

Integer division | Modulo | |
---|---|---|

The Calendar FAQ | 14/5 | 14 mod 5 |

Microsoft Excel (English) | INT(14/5) | MOD(14,5) |

Visual Basic | 14 \ 5 | 14 Mod 5 |

C, C#, C++ | 14 / 5 | 14 % 5 |

*NOTE: What is said here only applies to division of positive numbers. Different programming languages handle integer division of negative numbers differently; therefore the formulas in the Calendar FAQ avoid using these operations on negative numbers.*