[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 1

logbf, logbl, or logb Subroutine

Purpose

Computes the radix-independent exponent.

Syntax

#include <math.h>

float logbf (x)
float x;

long double logbl (x)
long double x;

double logb(x)
double x;

Description

The logbf and logbl subroutines compute the exponent of x, which is the integral part of logr | x |, as a signed floating-point value, for nonzero x, where r is the radix of the machine's floating-point arithmetic. For AIX, FLT_RADIX r=2.

If x is subnormal, it is treated as though it were normalized; thus for finite positive x:

1 <= x * FLT_RADIX-logb(x) < FLT_RADIX

An application wishing to check for error situations should set errno to zero and call feclearexcept(FE_ALL_EXCEPT) before calling these subroutines. Upon return, if errno is nonzero or fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is nonzero, an error has occurred.

Note
When the x parameter is finite and not zero, the logb (x) subroutine satisfies the following equation:

1 < = scalb (|x|, -(int) logb (x)) < 2

Parameters

x Specifies the value to be computed.

Return Values

Upon successful completion, the logbf and logbl subroutines return the exponent of x.

If x is ±0, a pole error occurs and the logbf and logbl subroutines return -HUGE_VALF and -HUGE_VALL, respectively.

If x is NaN, a NaN is returned.

If x is ±Inf, +Inf is returned.

Error Codes

The logb function returns -HUGE_VAL when the x parameter is set to a value of 0 and sets errno to EDOM.

Related Information

feclearexcept Subroutine and fetestexcept Subroutine.

math.h in AIX 5L Version 5.2 Files Reference.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]