lldiv


Division (long long type)

[Classification]

Standard library

[Syntax]

#include <stdlib.h>

lldiv_t lldiv(long long n, long long d);

[Return value]

The structure storing the result of the division is returned.

[Description]

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

This function calculates the quotient and remainder resulting from dividing numerator n by denominator d, and stores these two integers as the members of the following structure div_t.

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

 

quot the quotient, and rem is the remainder. If d is not zero, and if "r = div(n, d);", n is a value equal to
"r.rem + d * r.quot".

If d is zero, the resultant quot member has a sign the same as n and has the maximum size that can be expressed. The rem member is 0.

[Caution]

This function cannot be used when the -lang=c option and -strict_std option are both specified.