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
17   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
18
19       logb():
20           _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 500 ||
21           _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED || _ISOC99_SOURCE ||
22           _POSIX_C_SOURCE >= 200112L;
23           or cc -std=c99
24       logbf(), logbl():
25           _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600 ||
26           _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L;
27           or cc -std=c99
28

DESCRIPTION

30       These functions extract the exponent from the  internal  floating-point
31       representation of x and return it as a floating-point value.  The inte‐
32       ger constant FLT_RADIX, defined in <float.h>, indicates the radix  used
33       for  the  system's  floating-point  representation.  If FLT_RADIX is 2,
34       logb(x) is equal to floor(log2(x)), except that it is probably faster.
35
36       If x is subnormal, logb() returns the exponent x would have if it  were
37       normalized.
38

RETURN VALUE

40       On success, these functions return the exponent of x.
41
42       If x is a NaN, a NaN is returned.
43
44       If  x  is  zero,  then  a  pole  error occurs, and the functions return
45       -HUGE_VAL, -HUGE_VALF, or -HUGE_VALL, respectively.
46
47       If x is negative infinity or positive infinity, then positive  infinity
48       is returned.
49

ERRORS

51       See  math_error(7) for information on how to determine whether an error
52       has occurred when calling these functions.
53
54       The following errors can occur:
55
56       Pole error: x is 0
57              A  divide-by-zero  floating-point  exception  (FE_DIVBYZERO)  is
58              raised.
59
60       These functions do not set errno.
61

CONFORMING TO

63       C99, POSIX.1-2001.
64

SEE ALSO

66       ilogb(3), log(3)
67

COLOPHON

69       This  page  is  part of release 3.53 of the Linux man-pages project.  A
70       description of the project, and information about reporting  bugs,  can
71       be found at http://www.kernel.org/doc/man-pages/.
72
73
74
75                                  2010-09-20                           LOGB(3)
Impressum