expm1.3m (2010 09)

e
expm1(3M) expm1(3M)
NAME
expm1( ), expm1f( ), expm1l( ), expm1w( ), expm1q( ) - exponential minus 1 functions
SYNOPSIS
#include <math.h>
double expm1(double x);
HP Integrity Server Only
float expm1f(float x);
long double expm1l(long double x);
extended expm1w(extended x);
quad expm1q(quad x);
DESCRIPTION
The expm1() function is equivalent to exp(x
) - 1, but may be more accurate for very small values of x.
The
expm1() and log1p() functions are useful to guarantee that financial calculations of
(((1+x)**n)-1)/x are accurate when x is very small, namely:
expm1(n * log1p(x))/x
The preceding example might be applicable when calculating small daily interest rates.
See also
annuity().
Integrity Server Only
expm1f() is a float version of expm1(); it takes a float argument and returns a float
result.
expm1l() is a long double version of expm1(); it takes a long double argument and returns a
long double result.
expm1w() is an extended version of expm1(); it takes an extended argument and returns an
extended result.
expm1q() is equivalent to expm1l() on HP-UX systems.
USAGE
To use these functions, compile either with the default
-Ae option or with the -Aa
and
-D_HPUX_SOURCE options.
To use (for Integrity servers)
expm1w() or expm1q(), compile also with the -fpwidetypes option.
Make sure your program includes
<math.h>, and link in the math library by specifying -lm
on the com-
piler or linker command line.
For more information, see the HP-UX floating-point guide for HP Integrity servers at the following site:
http://www.hp.com/go/fp.
RETURN VALUE
expm1(±0) returns ±0.
If x is +INFINITY,
expm1() returns +INFINITY.
If x is INFINITY,
expm1() returns -1.0.
If x is NaN,
expm1() returns NaN.
expm1() returns infinity (equal to HUGE_VAL) in lieu of a value whose magnitude is too large, and
raises the overflow and inexact exceptions.
When it raises no other exception, whether
expm1() raises the inexact exception is unspecified.
ERRORS
If the correct value would overflow,
expm1() sets errno to [ERANGE].
Integrity Server Only
HP-UX
libm functions on Integrity server do not set errno by default. For errno setting, compile with
the +Olibmerrno option.
HP-UX 11i Version 3: September 2010 1 Hewlett-Packard Company 1

Summary of content (2 pages)