Loading...
Select Version
&pagelevel(4)&pagelevel
Definition | #include <stdlib.h> ldiv_t ldiv(long int dividend, long int divisor);
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 containing both the quotient quot and the remainder rem as |
Example | ldiv_t d; d = ldiv( 7, 3); /* d.quot = 2, d.rem = 1 */ d = ldiv(-7, 3); /* d.quot = -2, d.rem = -1 */ d = ldiv( 7,-3); /* d.quot = -2, d.rem = 1 */ d = ldiv(-7,-3); /* d.quot = 2, d.rem = -1 */ |
See also | div, lldiv |