Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > E

expm1(3M)

HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

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 compiler 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.

STANDARDS CONFORMANCE

expm1() : XPG4.2, ISO/IEC C99 (including Annex F, ``IEC 60559 floating-point arithmetic'')

expm1f(), expm1l() : ISO/IEC C99 (including Annex F, ``IEC 60559 floating-point arithmetic'')

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.