lldiv [V1.07 or later]


Perform division of long long type to obtain the quotient and remainder

[Classification]

Standard library

[Syntax]

#include <stdlib.h>

lldiv_t __far lldiv(long long int numer, long long int denom); (C99)

[Return value]

The structure holding the result of the division is returned. When divided by 0, -1 is set as quotient quot and numer is set as remainder rem.

[Description]

This function is used to divide a value of long long type.

This function calculates the quotient (quot) and remainder (rem) resulting from dividing numerator numer by denominator denom, and stores these two integers as the members of the following structure lldiv_t.

typedef struct {
    long long int quot;
    long long int rem;
} lldiv_t;

 

When the value cannot be divided, the quotient of the result becomes an integer that is closest to the algebraical quotient and has a smaller absolute value than it.