ldiv [ HP C/iX Library Reference Manual ] MPE/iX 5.0 Documentation
HP C/iX Library Reference Manual
ldiv
Computes the quotient and remainder of two long integers.
Syntax
#include <stdlib.h>
ldiv_t ldiv (long int numer, long int denom);
Parameters
numer The numerator.
denom The denominator.
Return Values
Returns a structure of type ldiv_t comprising the quotient and the
remainder. The structure contains the following:
long int quot; /* quotient */
long int rem; /* remainder */
Description
The ldiv function computes and returns the quotient and the remainder of
the division of numer by denom.
If the division is inexact, the sign of the resulting quotient and the
algebraic quotient are the same, and the magnitude of the resulting
quotient is the largest long int less than the magnitude of the algebraic
quotient.
If the result cannot be represented, the behavior is undefined;
otherwise, quot * denom + rem equals numer.
See Also
div(), abs(), labs(), ANSI C 4.10.6.4
MPE/iX 5.0 Documentation