expm1


expm1

Calculates the natural exponential of a number, minus one

 #include <math.h> double expm1 ( double x  ); float expm1f ( float x  ); long double expm1l ( long double x  ); 

The return value of the expm1( ) function is one less than e raised to the power of the function's argument, or ex, where e is Euler's number, 2.718281.... The expm1( ) function is designed to yield a more accurate result than the expression exp(x)-1, especially when the value of the argument is close to zero. If the result is beyond the range of the function's type, a range error occurs.

Example

 /* let y = (-e^(-2x) - 1 ) / (e^(-2x) + 1), for certain values of x */ double w, x, y; if (( x > 1.0E-12 ) && ( x < 1.0 )) {  w = expm1( -(x+x) );   y = - w / ( w + 2.0 ); } else   /* ... handle other values of x ... */ 

See Also

exp( ), log1p( ), log( )



C(c) In a Nutshell
C in a Nutshell (In a Nutshell (OReilly))
ISBN: 0596006977
EAN: 2147483647
Year: 2006
Pages: 473

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net