div(3C)
div, ldiv - perform integer division
As shipped in IRIX 6.5.15. Unchanged since IRIX 6.5.
NAME div, ldiv - perform integer division SYNOPSIS #include <stdlib.h> div_t div (int numer, int denom); ldiv_t ldiv (long int numer, long int denom); DESCRIPTION div and ldiv compute the quotient and remainder resulting from the division of the integer dividend numer by the integer divisor denom. If the division is inexact, the quotient will be the nearest integer with less magnitude than the algebraic quotient (e.g., div(5/2) yields 2, and div(-5/2) yields -2). div operates on and returns int quantities. ldiv operates on and returns long int quantities. Unless the result cannot be represented, div and ldiv return the result in a structure (div_t for div, ldiv_t for ldiv) which has two integer members: the quotient, quot, and the remainder, rem. These members are of type int for div, and long int for ldiv. DIAGNOSTICS If div or ldiv is invoked with a zero denom, the same integer divide-by- zero trap occurs as if the integer division had occurred in-line.