diff options
Diffstat (limited to 'src/stdlib/div.c')
-rw-r--r-- | src/stdlib/div.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/stdlib/div.c b/src/stdlib/div.c new file mode 100644 index 00000000..dfd80652 --- /dev/null +++ b/src/stdlib/div.c @@ -0,0 +1,22 @@ +#include <stdlib.h> + +/** calculate quotient and remainder **/ + +div_t div(int numer, int denom) +{ + div_t d; + d.quot = numer / denom; + d.rem = numer % denom; + return d; +} + +/*** +computes both the quotient and remainder of ARGUMENT(numer) +divided by ARGUMENT(denom). +***/ + +/* +UNDEFINED(The result cannot be represented) +RETURN_SUCCESS(a TYPEDEF(div_t) containing both the quotient and remainder) +STDC(1) +*/ |