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

ilogb(3M)

HP-UX 11i Version 3: February 2007
 

Technical documentation

Feedback
Content starts here

  Table of Contents

  Index

NAME

ilogb(), ilogbf(), ilogbl(), ilogbw(), ilogbq() — radix-independent exponent functions

SYNOPSIS

#include <math.h>

int ilogb(double x);

Integrity Server Only

int ilogbf(float x);

int ilogbl(long double x);

int ilogbw(extended x);

int ilogbq(quad x);

DESCRIPTION

The ilogb() function computes the exponent of the floating point value x. Formally, the return value is the integral part of log base r of |x| as a signed integral value, for nonzero x, where r is the radix of the machine's floating-point arithmetic. The radix r is 2 on HP-UX systems.

If x is denormal it is treated as though it were normalized before the exponent is determined.

Note: ilogb(x) is equivalent to (int)logb(x) for all values of x except NaN, INFINITY, and zero.

Integrity Servers Only

ilogbf() is a float version of ilogb(); it takes a float argument.

ilogbl() is a long double version of ilogb(); it takes a long double argument.

ilogbw() is an extended version of ilogb(); it takes an extended argument.

ilogbq() is equivalent to ilogbl() 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) ilogbw() or ilogbq(), compile also with the -fpwidetypes option.

Make sure your program includes <math.h>. 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

If x is NaN, ilogb() returns FP_ILOGBNAN.

If x is INFINITY, ilogb() returns INT_MAX.

If x is zero, ilogb() returns FP_ILOGB0.

Integrity Servers Only

If x is NaN, +-INFINITY, or zero, then the invalid floating-point exception is raised (as specified by C99 TC2)

The macros FP_ILOGBNAN and FP_ILOGB0 are defined in <math.h>.

ERRORS

No errors are defined.

STANDARDS CONFORMANCE

ilogb() : XPG4.2, ISO/IEC C99 (including Annex F, "IEC 60559 floating-point arithmetic")

ilogbf(), ilogbl() : 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.