LDIV(3) Library Functions Manual LDIV(3)
NAME
ldiv — compute
quotient and remainder of a long division
SYNOPSIS
#include <stdlib.h> ldiv_t ldiv(long int numer, long int denom);
DESCRIPTION
The ldiv() function computes the quotient and remainder of the division of the numerator numer by the denominator denom . If the division is inexact, the resulting quotient is the long integer of lesser magnitude that is the nearest to the algebraic quotient. If the result cannot be represented, the behaviour is undefined; otherwise, quot * denom + rem will equal numer .
RETURN VALUE
The ldiv() function returns a structure of type ldiv_t , comprising both the quotient and the remainder. The structure includes the following members, in any order:
| long int | quot; | /* quotient */ |
| long int | rem; | /* remainder */ |
ERRORS
No errors are defined.
EXAMPLES
None.
APPLICATION USAGE
None.
FUTURE DIRECTIONS
None.
SEE ALSO
div(3) , <stdlib.h> .
DERIVATION
Derived from the ISO C standard.
February 1997 posix.fail