div(3c) DG/UX 4.30 div(3c)
NAME
div, ldiv - compute quotient and remainder
SYNOPSIS
#include <stdlib.h>
divt div(numer, denom)
int numer
int denom;
ldivt ldiv(lnumer, denom)
long int lnumer
long int ldenom;
DESCRIPTION
The div function divides numer by denom to compute their
quotient and remainder. If the division is inexact, the
quotient is the integer of lesser magnitude that is nearest
to the algebraic quotient. Div returns a structure of type
divt, composed of members
int quot; /* quotient */
int rem; /* remainder */
in either order; quot * denom + rem will equal numer.
Ldiv is similar to div, but arguments and members of the
returned structure all have type long int.
DIAGNOSTICS
If the result of div or ldiv cannot be represented, their
behavior is undefined.
Licensed material--property of copyright holder(s) Page 1