How to get the exponent of a floating point number as an integer in C

1 Answer

0 votes
#include <stdio.h>
#include <math.h>

int main(void) {
	int exp = 0;
	float f = 2783534;

	exp = ilogbl(f);

	printf("%d\n", exp);

	return 0;
}



/*
run:

21

*/

 



answered Jul 31, 2022 by avibootz
...