The expf()
function – a variation of exp()
– computes e
raised to the power of x
for floating-point exponents in C.
#include<math.h>
Below is the declaration of the expf()
function, where x
is the floating-point exponent passed as a parameter to the function:
float expf(float x);
The function returns e
raised to the power of x
as a float
value.
#include <math.h>#include <stdio.h>int main(){float x;float y;x = 10.3;y = -2.5;printf("e^10.3 = %f", expf(x)); //Calculates e^10.3printf("\ne^-3.2 = %f", expf(y)); //Calculate e^-3.2return 0;}
Free Resources