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;
22 #include "_PDCLIB_test.h"
27 result = imaxdiv( (intmax_t)5, (intmax_t)2 );
28 TESTCASE( result.quot == 2 && result.rem == 1 );
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 TESTCASE( sizeof( result.quot ) == sizeof( intmax_t ) );
34 TESTCASE( sizeof( result.rem ) == sizeof( intmax_t ) );