HPlogo HP-UX Reference > E

exp2(3M)

HP-UX 11i Version 2: December 2007 Update
» 

Technical documentation

 » Table of Contents

 » Index

NAME

exp2(), exp2f(), exp2l(), exp2w(), exp2q() — base-2 exponential functions

SYNOPSIS

#include <math.h>

double exp2(double x);

Itanium(R)-based System Only

float exp2f(float x);

long double exp2l(long double x);

extended exp2w(extended x);

quad exp2q(quad x);

DESCRIPTION

exp2() returns 2x.

Itanium-based Sysstem Only

exp2f() is a float version of exp2(); it takes a float argument and returns a float result.

exp2l() is a long double version of exp2(); it takes a long double argument and returns a long double result.

exp2w() is an extended version of exp2(); it takes an extended argument and returns an extended result.

exp2q() is equivalent to exp2l() 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 Itanium-based systems) exp2w() or exp2q(), compile also with the -fpwidetypes option.

To use these functions, 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.

RETURN VALUE

exp2(±0) returns 1.

If x is +INFINITY, exp2() returns +INFINITY.

If x is -INFINITY, exp2() returns zero.

If x is NaN, exp2() returns NaN.

exp2() returns infinity (equal to HUGE_VAL) in lieu of a value whose magnitude is too large, and raises the overflow and inexact exceptions.

exp2() raises the underflow and inexact exceptions whenever a result is tiny (essentially denormal or zero) and thereby suffers loss of accuracy, and may raise those exceptions if the result is merely tiny.

exp2() raises the inexact exception whenever a rounded result does not equal the mathematical result.

ERRORS

Itanium-based System Only

If the correct value would overflow, exp2() sets errno to [ERANGE].

HP-UX libm functions on Itanium-based systems do not set errno by default. For errno setting, compile with the +Olibmerrno option.

STANDARDS CONFORMANCE

exp2(), exp2f(), exp2l() : ISO/IEC C99 (including Annex F, ``IEC 60559 floating-point arithmetic'')