What is expf() in C?

The expf() function – a variation of exp() – computes e raised to the power of x for floating-point exponents in C.

Mathematical Representation

Library

#include<math.h>

Syntax

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.

Code

#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.3
printf("\ne^-3.2 = %f", expf(y)); //Calculate e^-3.2
return 0;
}

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved