div()

compute quotient and remainder of integer division 

Function


SYNOPSIS

#include <stdlib.h>

div_t div(int numer, int denom);


DESCRIPTION

The div() function computes the quotient and remainder of the division of the numerator numer by the denominator denom. If the division is inexact, the resulting quotient is the integer of lesser magnitude that is the nearest to the algebraic quotient. If the result cannot be represented, the behavior is undefined. Otherwise, quotient * denom + remainder equals numer.


PARAMETERS

numer 

Is the numerator.

denom 

Is the denominator.


RETURN VALUES

The div() function returns a structure of type div_t, comprising both the quotient and the remainder. The structure contains the following members in either order:

int quot; /* quotient */
int rem; /* remainder */

CONFORMANCE

ANSI/ISO 9899-1990.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

None.


AVAILABILITY

MKS Toolkit for Professional Developers
MKS Toolkit for Enterprise Developers
MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
ldiv()


MKS Toolkit 9.3 Documentation Build 6.