コード例 #1
0
ファイル: main.c プロジェクト: bBusker/CSC190
void p1(void)
{
    int a[5]={0,4,5,19,23};
    int b[5]={1,4,5,19,23};
    printf("The first set of bits are set? %u\n", testBits(a, 5, 9131953));
    printf("The second set of bits are set? %u\n", testBits(b, 5, 9131953));
}
コード例 #2
0
int
main( void )
{
    printf("obase=16\n");
    printf("ibase=2\n");

    testBits (1.0,
	      "0 01111 0000000000",
	      "0 01111111 00000000000000000000000");
    testBits (1.0 + HALF_EPSILON,
	      "0 01111 0000000001",
	      "0 01111111 00000000010000000000000");
    testBits (1.0 + HALF_EPSILON * 0.5,
	      "0 01111 0000000001",
	      "0 01111111 00000000010000000000000");
    testBits (1.0 + HALF_EPSILON * 0.4999,
	      "0 01111 0000000000",
	      "0 01111111 00000000000000000000000");
    testBits (1.0 + HALF_EPSILON * 0.5001,
	      "0 01111 0000000001",
	      "0 01111111 00000000010000000000000");
    testBits (1.0 - HALF_EPSILON * 0.5,
	      "0 01110 1111111111",
	      "0 01111110 11111111110000000000000");
    testBits (1.0 - HALF_EPSILON * 0.5 * 0.5,
	      "0 01111 0000000000",
	      "0 01111111 00000000000000000000000");
    testBits (1.0 - HALF_EPSILON * 0.5 * 0.4999,
	      "0 01111 0000000000",
	      "0 01111111 00000000000000000000000");
    testBits (1.0 - HALF_EPSILON * 0.5 * 0.5001,
	      "0 01110 1111111111",
	      "0 01111110 11111111110000000000000");


    printf("quit\n");
    return (0);
}