div(3C) div(3C)
NAME
div, ldiv - compute quotient and remainder
SYNOPSIS
#include <stdlib.h>
divt div (numer, denom)
int numer, denom ;
ldivt ldiv (numer, denom)
long int numer, denom ;
DESCRIPTION
The div function computes the quotient and remainder of the
division of numer by denom. If the division is inexact, the
resulting quotient is the integer of lesser magnitude that
is the nearest to the algebraic quotient. div returns a
structure of type divt, which has two members:
int quot;
int rem;
If the result cannot be represented the behavior is unde-
fined; otherwise, quot * denom + rem shall equal numer.
Ldiv is just like div except that it takes arguments of type
long int and returns a ldivt structure.
Page 1 CX/UX Programmer's Reference Manual