Guardian Native C Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
div(3) Guardian Native C Library Calls Reference Manual
NAME
div - Divides integers
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZCRTLSRL
G-series native OSS processes: /G/system/sysnn/zcrtlsrl
H-series and J-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCRTLDLL
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zcrtldll
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/ycrtldll
SYNOPSIS
#include <stdlib.h>
div_t div (
int numerator,
int denominator);
PARAMETERS
numerator Specifies an integer.
denominator Specifies 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 undefined. The div() function returns a structure of type div_t, compris-
ing both the quotient and the remainder.
A two’s-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: floor(3), ldiv(3), lldiv(3).
1−158 Hewlett-Packard Company 527192-018