summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/inttypes/imaxdiv.c15
-rw-r--r--src/stdlib/lldiv.c9
2 files changed, 18 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)
*/
diff --git a/src/stdlib/lldiv.c b/src/stdlib/lldiv.c
index f4835ec2..7487aee2 100644
--- a/src/stdlib/lldiv.c
+++ b/src/stdlib/lldiv.c
@@ -1,5 +1,7 @@
#include <stdlib.h>
+/** calculate quotient and remainder **/
+
lldiv_t lldiv(long long int numer, long long int denom)
{
lldiv_t d;
@@ -8,6 +10,13 @@ lldiv_t lldiv(long long int numer, long long int 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(ldiv_t) containing both the quotient and remainder)
STDC(199901)
*/