ILOGB 3CW "09 March 2006" "mathcw-1.00"

Table of contents


NAME

ilogbf, ilogb, ilogbl, ilogbw, ilogbq, ilogbll, ilogbdf, ilogbd, ilogbdl, ilogbdll - get unbiased exponent of floating-point number

SYNOPSIS

cc [ flags ] -I/usr/local/include file(s) -L/usr/local/lib -lmcw [ ... ]

#include <mathcw.h>

extern int ilogbf (float x);

extern int ilogb (double x);

extern int ilogbl (long double x);

extern int ilogbw (__float80 x);

extern int ilogbq (__float128 x);

extern int ilogbll (long_long_double x);

extern int ilogbdf (decimal_float x);

extern int ilogbd (decimal_double x);

extern int ilogbdl (decimal_long_double x);

extern int ilogbdll (decimal_long_long_double x);

NB: Functions with prototypes containing underscores in type names may be available only with certain extended compilers.


DESCRIPTION

Compute the base-b exponent of the argument as a signed integer value, where b is the base (radix) of the host floating-point system.

RETURN VALUES

If x is zero, return FP_ILOGB0. If x is a NaN, return FP_ILOGBNAN. If |x| is Infinity, return INT_MAX. Otherwise, return the equivalent of (int)logb(x).

For positive nonzero x, the result is a value that satisfies x = significand * base**(ilogb(x)), with 1 <= significand < base.

For example, in binary (base-2) arithmetic, ilogb(1.5) = 0, ilogb(2.5) = 1, and ilogb(10.5DD) = 3. In decimal arithmetic, ilogbd(1.5DD) = 0, ilogbd(2.5DD) = 0, and ilogbd(10.5DD) = 1. In hexadecimal arithmetic, ilogb(1.5) = 0, ilogb(2.5) = 0, ilogb(10.5) = 0, and ilogb(16.5) = 1.


ERRORS

If the argument is zero, set errno to ERANGE.

SEE ALSO

frexp(3CW), isinf(3CW), isnan(3CW), ldexp(3CW), logb(3CW), scalbn(3CW), scalbnl(3CW).