summaryrefslogtreecommitdiff
path: root/src/inttypes/imaxdiv.c
blob: eb99f2cf24b242bc97139c819eb5fb2fab7dc60d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <stddef.h>
#include <inttypes.h>

/** calculate quotient and remainder **/

imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom)
{
	imaxdiv_t r;
	r.quot = numer / denom;
	r.rem = numer % denom;
	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)
*/