Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

imaxdiv - division of integers (intmax_t)

&pagelevel(4)&pagelevel

Syntax

#include <inttypes.h>

imaxdiv_t imaxdiv(intmaxt_t dividend, intmaxt_t divisor);

Description

imaxdiv() computes the quotient and remainder of the division of dividend by divisor.

intmax_t is a type predefined in the header stdint.h:
typedef long long intmax_t;

imaxdiv_t is a type of a structure predefined in the header stdint.h which contains both the quotient quot and the remainder rem as intmax_t values.

The sign of the quotient is the same as the sign of the algebraic quotient. The value of the quotient is the highest integer less than or equal to the absolute value of the algebraic quotient.

The remainder is expressed by the following equation:
Quotient * Divisor + Remainder = Dividend

Return val.

Structure of type ldiv_t

 

        

if successful. The structure includes the quotient quot as well as the remainder rem as intmax_t-values.

See also

div()ldiv(), lldiv()stdint.h.