How to calculate e raised to the power of floating-point value in C

2 Answers

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

int main(void) {
	float x = 8.7;

	printf("%f", expf(x));  

	return 0;
}




/*
run:

6002.911133

*/

 



answered Jul 31, 2022 by avibootz
0 votes
#include <stdio.h>
#include <math.h>

int main(void) {
	float x = -3.8;

	printf("%f", expf(x));  

	return 0;
}




/*
run:

0.022371

*/

 



answered Jul 31, 2022 by avibootz
...