lldiv
—divide two long long integersSynopsis
#include <stdlib.h> lldiv_t lldiv(long long n, long long d);
Description
Divide
n/d,
returning quotient and remainder as two long long integers in a structure
lldiv_t
.
Returns
The result is represented with the structure
typedef struct { long long quot; long long rem; } lldiv_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 long
rather than long long
values, use the similar
function ldiv
.
Portability
lldiv
is ISO 9899 (C99) compatable.
No supporting OS subroutines are required.