Guardian Native C Library Calls Reference Manual (G06.28+, H06.05+)

Guardian Native C Library Calls (a - e) div(3)
NAME
div - Divides integers
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZCRTLSRL
G-series native OSS processes: /G/system/sysnn/zcrtlsrl
H-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCRTLDLL
H-series OSS processes: /G/system/zdllnnn/zcrtldll
SYNOPSIS
#include <stdlib.h>
div_t div (
int numerator,
int denominator);
PARAMETERS
numerator Species an integer.
denominator Species an integer.
DESCRIPTION
The div( ) function computes the quotient and remainder of the division of the numerator by the
denominator. If the division is inexact, the sign of the resulting quotient is that of the algebraic
quotient, and the magnitude of the resulting quotient is the largest integer less than the magnitude
of the algebraic quotient. If the result cannot be represented (for example, if the denominator is 0
[zero]), the behavior is undened. The div() function returns a structure of type div_t, compris-
ing both the quotient and the remainder.
Atwos-complement integer can hold a negative number whose absolute value is too large for
the integer to hold.
RETURN VALUES
The div( ) function returns a structure of type div_t. The struct returned contains members
named quot and rem; their type is the same as the type of the parameters.
RELATED INFORMATION
Functions: oor(3), ldiv(3), lldiv(3).
527192-007 Hewlett-Packard Company 151