exp, expl

From RAD Studio
Jump to: navigation, search

Go Up to math.h Index


Header File

math.h

Category

Math Routines

Prototype

double exp(double x);

long double expl(long double x);

Description

Calculates the exponential e to the x.

expl is the long double version; it takes a long double argument and returns a long double result.

Return Value

exp returns e to the x.

Sometimes the arguments passed to these functions produce results that overflow or are incalculable. When the correct value overflows, exp returns the value HUGE_VAL and expl returns _LHUGE_VAL. Results of excessively large magnitude cause the global variable errno to be set to

ERANGE

Result out of range



On underflow, these functions return 0.0, and the global variable errno is not changed. Error handling for these functions can be modified through the functions _matherr and _matherrl.

Example

#include <stdio.h>
#include <math.h>
int main(void)
{
   double result;
   double x = 4.0;
   result = exp(x);
   printf("'e' raised to the power \
          of %lf (e ^ %lf) = %lf\n",
          x, x, result);
   return 0;
}

Portability

POSIX Win32 ANSI C ANSI C++

exp

+

+

+

+

expl

+

+

+