Chapter Contents

Previous

Next
exp

exp



Compute the Exponential Function

Portability: ISO/ANSI C conforming, UNIX compatible


SYNOPSIS
DESCRIPTION
RETURN VALUE
DIAGNOSTICS
EXAMPLE
RELATED FUNCTIONS
SEE ALSO


SYNOPSIS

#include <math.h>

double exp(double x);


DESCRIPTION

exp computes the exponential function of its argument x . The result is e to the x power, where e is the base of natural logarithms, 2.71828 . . ..

The exponential function is the inverse of the natural logarithm and is expressed by this relation:

[IMAGE]

x is a double-precision, floating-point number.


RETURN VALUE

exp returns the exponential function of its argument x , expressed as a double-precision, floating-point number.


DIAGNOSTICS

If x is too large and the ensuing result is so large that it cannot be represented, exp returns HUGE_VAL . In this case, the run-time library writes an error message to the standard error file ( stderr ).

If an error occurs in exp , the _matherr routine is called. You can supply your own version of _matherr to suppress the diagnostic message or modify the value returned.


EXAMPLE

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

#define XVAL 10.0

main()
{
   double y;

      /* Compute exponent function. */
   y = exp(-XVAL);  
   printf("exp(-%f) = %f\n", XVAL, y);
}


RELATED FUNCTIONS

_matherr


SEE ALSO


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.