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 > L

ldexp(3M)

HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

ldexp(), ldexpf(), ldexpl(), ldexpw(), ldexpq() — scale exponent of a floating-point number

SYNOPSIS

#include <math.h>

double ldexp(double x, int exp);

HP Integrity Server Only

float ldexpf(float x, int exp);

long double ldexpl(long double y, int exp);

extended ldexpw(extended x, int exp);

quad ldexpq(quad x, int exp);

DESCRIPTION

The ldexp() function computes the quantity x* 2exp.

ldexp() computes the same value as scalbn().

Integrity Server Only

ldexpf() is a float version of ldexp(); it takes a float first argument and returns a float result.

ldexpl() is a long double version of ldexp(); it takes a long double first argument and returns a long double result.

ldexpw() is an extended version of ldexp(); it takes a extended first argument and returns an extended result.

ldexpq() is equivalent to ldexpl() on HP-UX systems.

USAGE

To use (for Integrity servers) ldexpf(), compile either with the default -Ae option or with the -Aa option.

To use (for Integrity servers) ldexpl(), ldexpw(), or ldexpq(), compile either with the default -Ae option or with the -Aa and -D_HPUX_SOURCE options.

To use (for Integrity servers) ldexpw() or ldexpq(), compile also with the -fpwidetypes option.

To use any of 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 for HP Integrity servers at the following site: http://www.hp.com/go/fp.

RETURN VALUE

Upon successful completion, the ldexp() function returns x* 2exp.

If x is ±INFINITY, zero, or a NaN, ldexp() returns x.

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

ldexp() 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.

ERRORS

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

Integrity Server Only

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

STANDARDS CONFORMANCE

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

ldexpf(), ldexpl() 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.