How to use ilogb() function to extract the value of the exponent from the floating-point argument in C

1 Answer

0 votes
#include <stdio.h>     
#include <math.h>
 
int main(int argc, char **argv)
{	
    printf("ilogb(12.34) = %d\n", ilogb(12.34));
	printf("ilogb(100.0) = %d\n", ilogb(100.0));
	printf("ilogb(0.0) = %d\n", ilogb(0.0));
	
    return 0;
}

/*
run:
  
ilogb(12.34) = 3
ilogb(100.0) = 6
ilogb(0.0) = -2147483648

*/

 



answered Mar 19, 2016 by avibootz
...