Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
imaxdiv(3) OSS Library Calls Reference Manual
NAME
imaxdiv - Divides integers
LIBRARY
H-series and J-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCREDLL
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zcredll
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/ycredll
SYNOPSIS
#include <inttypes.h>
imaxdiv_t imaxdiv (
intmax_t numerator,
intmax_t denominator);
PARAMETERS
numerator Specifies an integer.
denominator Specifies an integer.
DESCRIPTION
The imaxdiv( ) 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 alge-
braic 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 imaxdiv( ) function performs the same function as the div( ) function, but accepts integers of
type intmax_t as parameters. The imaxdiv( ) function returns a structure of type imaxdiv_t,
comprising 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 imaxdiv( ) function returns a structure of type imaxdiv_t. The struct returned contains
members named quot and rem; their type is the same as the type of the parameters.
RELATED INFORMATION
Functions: div(3), floor(3), ldiv(3).
4−18 Hewlett-Packard Company 527187-017