25 int gedouble( 
double *number1, 
double *number2 );
    28 int gedouble( 
double *number1, 
double *number2 )
    31     return ( *number1 >= *number2 );
    36     int    i, j, iswitch, ifrandom, ifhunt, ntable, offset, multiplier, ntest, index;
    41     scanf( 
"%i %i %i", &ntable, &offset, &multiplier );
    42     ntest = abs( multiplier ) * ( ntable - 1 ) + 1;
    43     printf( 
"ntable, offset, multiplier, ntest = %i, %i, %i, %i\n", ntable, offset, multiplier, ntest );
    45     table = (
double *) malloc( ntable * 
sizeof ( 
double ) );
    48         printf( 
"Could not malloc desired memory\n" );
    54     for ( i = 0; i < ntable; i++ )
    56         table[i] = (double) i;
    59     for ( iswitch = 0; iswitch < 4; iswitch++ )
    61         ifrandom = ( iswitch & 0x1 ) == 0x1;
    62         ifhunt   = ( iswitch & 0x2 ) == 0x2;
    67         for ( i = 0; i < ntest; i++ )
    71                 j = (int) ( (
double) ntest * (double) rand() / ( ( (double) RAND_MAX ) + 1. ) );
    78             test = offset + (double) j / (
double) multiplier;
    81             bhunt_search( &test, table, ntable, 
sizeof ( 
double ), &index, ( 
int ( * )( 
const void *, 
const void * ) )
gedouble );
    82             if ( index < -1 || index > ntable - 1 )
    84                 printf( 
"ERROR: test = %20.16f lead to an invalid index of %i\n", test, index );
    88             if ( !( ( index == -1 && test < table[index + 1] ) || ( index > -1 && index < ntable - 1 && table[index] <= test && test < table[index + 1] ) || ( index == ntable - 1 && table[index] <= test ) ) )
    92                     printf( 
"ERROR for index == -1,  test = %20.16f, table[index+1] = %20.16f\n", test, table[index + 1] );
    95                 else if ( index > -1 && index < ntable - 1 )
    97                     printf( 
"ERROR for index > -1 && index < ntable-1,  table[index] = %20.16f, test = %20.16f, table[index+1] = %20.16f\n", table[index], test, table[index + 1] );
   100                 else if ( index == ntable - 1 )
   102                     printf( 
"ERROR for index == ntable - 1, table[index] = %20.16f, test = %20.16f\n", table[index], test );
   107                     printf( 
"Internal logic ERROR\n" );
   112         printf( 
"Average number of gedouble calls per bhunt_search call = %f for ifhunt, ifrandom = %i,%i\n", (
double) 
count_gedouble / (
double) ntest, ifhunt, ifrandom );
   114     printf( 
"Successful completion of bhunt_search test\n" );
   116     free( (
void *) table );
 void bhunt_search(const void *key, const void *base, int n, size_t size, int *low, int(*ge)(const void *keyval, const void *datum))
int gedouble(double *number1, double *number2)