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           _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
21               || _XOPEN_SOURCE >= 500
22               || /* Since glibc 2.19: */ _DEFAULT_SOURCE
23               || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
24       logbf(), logbl():
25           _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
26               || /* Since glibc 2.19: */ _DEFAULT_SOURCE
27               || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
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

ATTRIBUTES

63       For  an  explanation  of  the  terms  used   in   this   section,   see
64       attributes(7).
65
66       ┌─────────────────────────┬───────────────┬─────────┐
67Interface                Attribute     Value   
68       ├─────────────────────────┼───────────────┼─────────┤
69logb(), logbf(), logbl() │ Thread safety │ MT-Safe │
70       └─────────────────────────┴───────────────┴─────────┘

CONFORMING TO

72       C99, POSIX.1-2001, POSIX.1-2008.
73

SEE ALSO

75       ilogb(3), log(3)
76

COLOPHON

78       This  page  is  part of release 5.07 of the Linux man-pages project.  A
79       description of the project, information about reporting bugs,  and  the
80       latest     version     of     this    page,    can    be    found    at
81       https://www.kernel.org/doc/man-pages/.
82
83
84
85                                  2017-09-15                           LOGB(3)
Impressum