Embedded Artistry Framework
Embedded Systems C++ Framework
Functions
imaxdiv.c File Reference
#include <stdlib.h>
Include dependency graph for imaxdiv.c:

Functions

imaxdiv_t imaxdiv (intmax_t numer, intmax_t denom)
 Computes both the quotient and the remainder of the division of the numerator x by the denominator y. More...
 

Function Documentation

◆ imaxdiv()

imaxdiv_t imaxdiv ( intmax_t  numer,
intmax_t  denom 
)

Computes both the quotient and the remainder of the division of the numerator x by the denominator y.

Computes both the quotient and the remainder of the division of the numerator x by the denominator y. Computes quotient and remainder simultaneously. The quotient is the algebraic quotient with any fractional part discarded (truncated towards zero). The remainder is such that quot * y + rem == x.

Computes the quotient (the result of the expression x/y) and remainder (the result of the expression xy) simultaneously.

Parameters
numerintmax_t values (numerator)
denomintmax_t values (denominator)
Returns
If both the remainder and the quotient can be represented as objects of the corresponding type (int, long, long long, imaxdiv_t, respectively), returns both as an object of type
See also
div_t,
ldiv_t,
lldiv_t,
imaxdiv_t.

If either the remainder or the quotient cannot be represented, the behavior is undefined.

References imaxdiv_t::quot, and imaxdiv_t::rem.