1LOGB(3)                    Linux Programmer's Manual                   LOGB(3)
2
3
4

NAME

6       logb, logbf, logbl - get exponent of a floating point value
7

SYNOPSIS

9       #include <math.h>
10
11       double logb(double x);
12       float logbf(float x);
13       long double logbl(long double x);
14
15       Link with -lm.
16

DESCRIPTION

18       These  functions extract the exponent of x and return it as a floating-
19       point value.  If FLT_RADIX is two, logb(x) is equal to  floor(log2(x)),
20       except it's probably faster.
21
22       If  x  is de-normalized, logb() returns the exponent x would have if it
23       were normalized.
24
25       If x is zero, -HUGE_VAL (resp. -HUGE_VALF, -HUGE_VALL) is returned, and
26       a  pole error occurs.  If x is infinite, plus infinity is returned.  If
27       x is NaN, NaN is returned.
28

ERRORS

30       In order to check for errors, set errno to  zero  and  call  feclearex‐
31       cept(FE_ALL_EXCEPT) before calling these functions. On return, if errno
32       is non-zero or fetestexcept(FE_INVALID | FE_DIVBYZERO |  FE_OVERFLOW  |
33       FE_UNDERFLOW) is non-zero, an error has occurred.
34
35       If  an  error  occurs  and (math_errhandling & MATH_ERRNO) is non-zero,
36       then errno is set to ERANGE.  If an error occurs and  (math_errhandling
37       &  MATH_ERREXCEPT)  is non-zero, then the divide-by-zero floating-point
38       exception is raised.
39
40       A pole error occurs when x is zero.
41

HISTORY

43       The logb() function occurs in 4.3BSD.
44

CONFORMING TO

46       C99
47

SEE ALSO

49       log(3), ilogb(3)
50
51
52
53                                  2004-10-31                           LOGB(3)
Impressum