diff options
| author | Jakob Kaivo <jkk@ung.org> | 2019-02-27 20:12:42 -0500 |
|---|---|---|
| committer | Jakob Kaivo <jkk@ung.org> | 2019-02-27 20:12:42 -0500 |
| commit | bf34b41a15fa79930e19379c68f695b07332f7eb (patch) | |
| tree | 7554bfb963aca7c2023334b72c2d466cc80a4bf2 /src/inttypes | |
| parent | 35428c37f6698306948557d681fa536c20f90557 (diff) | |
uniform behavior and documentation for (imax|ll|l)div()
Diffstat (limited to 'src/inttypes')
| -rw-r--r-- | src/inttypes/imaxdiv.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/inttypes/imaxdiv.c b/src/inttypes/imaxdiv.c index b8344e5a..a213f9da 100644 --- a/src/inttypes/imaxdiv.c +++ b/src/inttypes/imaxdiv.c @@ -1,20 +1,23 @@ #include "stddef.h" #include <inttypes.h> +/** calculate quotient and remainder **/ + imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom) { - imaxdiv_t r = {0}; - if (denom == 0) { - /* undefined */ - return r; - } + imaxdiv_t r; r.quot = numer / denom; r.rem = numer % denom; - /* if either cannot be represented, undefined */ return r; } +/*** +computes both the quotient and remainder of ARGUMENT(numer) +divided by ARGUMENT(denom). +***/ /* +UNDEFINED(The result cannot be represented) +RETURN_SUCCESS(a TYPEDEF(ldiv_t) containing both the quotient and remainder) STDC(199901) */ |
