HP 3000 Manuals

div [ HP C/iX Library Reference Manual ] MPE/iX 5.0 Documentation


HP C/iX Library Reference Manual

div 

Computes the quotient and remainder of two integers.

Syntax 

     #include <stdlib.h>
     div_t div (int numer, int denom);

Parameters 

numer         The numerator.

denom         The denominator.

Return Values 

Returns a structure of type div_t, comprising the quotient and the
remainder.  The structure contains the following:

     int quot;    /* quotient */
     int rem;     /* remainder */

Description 

The div 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
quotients is the largest integer 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 

ldiv(), ANSI C 4.10.6.2



MPE/iX 5.0 Documentation