|
leapc
|
Quotient and modulo function implementations. More...
#include "quo_mod.h"
Go to the source code of this file.
Functions | |
| struct quo_mod | quo_mod (int x, int y) |
| Compute the integer quotient and modulus. | |
Quotient and modulo function implementations.
Implements the quotient and modulo function declared in the quo_mod.h header file.
Definition in file quo_mod.c.
Compute the integer quotient and modulus.
Performs an integer modulo operation. Then subtracts the modulus from the numerator and applies an integer division in order to compute the quotient.
The following invariant proves true: the numerator matches the denominator multiplied by the quotient plus the modulus.
| x | Numerator integer. |
| y | Denominator integer. Must not be zero. |
quo_mod structure comprising the quotient and modulus. quo_mod identifier exists in structure namespace as well as function namespace. y is zero.