1logb(3) Library Functions Manual logb(3)
2
3
4
6 logb, logbf, logbl - get exponent of a floating-point value
7
9 Math library (libm, -lm)
10
12 #include <math.h>
13
14 double logb(double x);
15 float logbf(float x);
16 long double logbl(long double x);
17
18 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
19
20 logb():
21 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
22 || _XOPEN_SOURCE >= 500
23 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
24 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
25
26 logbf(), logbl():
27 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
28 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
29 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
30
32 These functions extract the exponent from the internal floating-point
33 representation of x and return it as a floating-point value. The inte‐
34 ger constant FLT_RADIX, defined in <float.h>, indicates the radix used
35 for the system's floating-point representation. If FLT_RADIX is 2,
36 logb(x) is equal to floor(log2(x)), except that it is probably faster.
37
38 If x is subnormal, logb() returns the exponent x would have if it were
39 normalized.
40
42 On success, these functions return the exponent of x.
43
44 If x is a NaN, a NaN is returned.
45
46 If x is zero, then a pole error occurs, and the functions return
47 -HUGE_VAL, -HUGE_VALF, or -HUGE_VALL, respectively.
48
49 If x is negative infinity or positive infinity, then positive infinity
50 is returned.
51
53 See math_error(7) for information on how to determine whether an error
54 has occurred when calling these functions.
55
56 The following errors can occur:
57
58 Pole error: x is 0
59 A divide-by-zero floating-point exception (FE_DIVBYZERO) is
60 raised.
61
62 These functions do not set errno.
63
65 For an explanation of the terms used in this section, see at‐
66 tributes(7).
67
68 ┌────────────────────────────────────────────┬───────────────┬─────────┐
69 │Interface │ Attribute │ Value │
70 ├────────────────────────────────────────────┼───────────────┼─────────┤
71 │logb(), logbf(), logbl() │ Thread safety │ MT-Safe │
72 └────────────────────────────────────────────┴───────────────┴─────────┘
73
75 C11, POSIX.1-2008.
76
78 C99, POSIX.1-2001.
79
80 logb() 4.3BSD (see IEEE.3 in the 4.3BSD manual).
81
83 ilogb(3), log(3)
84
85
86
87Linux man-pages 6.05 2023-07-20 logb(3)