ldiv
---divide two long integersSynopsis
#include <stdlib.h> ldiv_t ldiv(long n, long d);
Description
Divide
n/d,
returning quotient and remainder as two long integers in a structure ldiv_t
.
Returns
The result is represented with the structure
typedef struct { long quot; long rem; } ldiv_t;
where the quot
field represents the quotient, and rem
the
remainder. For nonzero d, if `r = ldiv(n,d);
' then
n equals `r.rem + d*r.quot
'.
To divide int
rather than long
values, use the similar
function div
.
Portability
ldiv
is ANSI.
No supporting OS subroutines are required.
Packaging copyright © 1988-2000 OAR Corporation Context copyright by each document's author. See Free Software Foundation for information.