Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
div
Expand Minimize

exp, expf

Calculates the exponential.

double exp( 
   double x
);
float exp(
   float x
);  // C++ only
long double exp(
   long double x
);  // C++ only
float expf( 
   float x
);

Parameter

x
Floating-point value.

Return Value

The exp function returns the exponential value of the floating-point parameter, x, if successful. On overflow, the function returns INF (infinite) and on underflow, exp returns 0.

Input SHE Exception Matherr Exception
± QNAN,IND None _DOMAIN
± ∞ INVALID _DOMAIN
x ≥ 7.097827e+002 INEXACT+OVERFLOW OVERFLOW
X ≤ -7.083964e+002 INEXACT+UNDERFLOW UNDERFLOW

exp has an implementation that uses Streaming SIMD Extensions 2 (SSE2). See _set_SSE2_enable for information and restrictions on using the SSE2 implementation.

Remarks

C++ allows overloading, so you can call overloads of exp. In a C program, exp always takes and returns a double.

Requirements

Function Required header Compatibility
exp, expf <math.h> ANSI, Win 98, Win Me, Win NT, Win 2000, Win XP

For additional compatibility information, see Compatibility in the Introduction.

Libraries

All versions of the C run-time libraries.

Example

// crt_exp.c

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

int main( void )
{
   double x = 2.302585093, y;

   y = exp( x );
   printf( "exp( %f ) = %f\n", x, y );
}

Output

exp( 2.302585 ) = 10.000000

See Also

Floating-Point Support Routines | log | Run-Time Routines and .NET Framework Equivalents

Show:
© 2015 Microsoft