HPlogo HP-UX Reference > L

logb(3M)

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

Technical documentation

 » Table of Contents

 » Index

NAME

logb(), logbf(), logbl(), logbw(), logbq() — radix-independent exponent functions

SYNOPSIS

#include <math.h>

double logb(double x);

Itanium(R)-based System Only

float logbf(float x);

long double logbl(long double x);

extended logbw(extended x);

quad logbq(quad x);

DESCRIPTION

The logb() 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 floating point 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.

Itanium-based System Only

logbf() is a float version of logb(); it takes a float argument and returns a float result.

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

logbw() is an extended version of logb(); it takes an extended argument and returns an extended result.

logbq() is equivalent to logbl() 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) logbw() or logbq(), compile also with -fpwidetypes.

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.

RETURN VALUE

Upon successful completion, logb() returns the exponent of x.

If x is NaN, logb() returns NaN.

If x is ±INFINITY, logb() returns +INFINITY.

If x is zero, logb() returns -HUGE_VAL (equal to -INFINITY) and raises the divide-by-zero floating-point exception.

ERRORS

If x is zero, logb() sets errno to [EDOM].

Itanium-based System Only

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

STANDARDS CONFORMANCE

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

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