3 /* lldiv( long long int, long long int )
5 This file is part of the Public Domain C Library (PDCLib).
6 Permission is granted to use, modify, and / or redistribute at will.
13 imaxdiv_t imaxdiv( intmax_t numer, intmax_t denom )
16 rc.quot = numer / denom;
17 rc.rem = numer % denom;
24 #include <_PDCLIB_test.h>
29 result = imaxdiv( (intmax_t)5, (intmax_t)2 );
30 TESTCASE( result.quot == 2 && result.rem == 1 );
31 result = imaxdiv( (intmax_t)-5, (intmax_t)2 );
32 TESTCASE( result.quot == -2 && result.rem == -1 );
33 result = imaxdiv( (intmax_t)5, (intmax_t)-2 );
34 TESTCASE( result.quot == -2 && result.rem == 1 );
35 TESTCASE( sizeof( result.quot ) == sizeof( intmax_t ) );
36 TESTCASE( sizeof( result.rem ) == sizeof( intmax_t ) );