summaryrefslogtreecommitdiff
path: root/src/stdlib/div.c
blob: 3cb2df78a94d4b7bfe0c5b97201111ac4d19c287 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <stdlib.h>
#include "_stdlib.h"

/** calculate quotient and remainder **/

div_t div(int numer, int denom)
{
	div_t d;

	SIGNAL_SAFE(0);

	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)
*/