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