1LOGB(3) Linux Programmer's Manual LOGB(3)
2
3
4
6 logb, logbf, logbl - get exponent of a floating-point value
7
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(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 500 ||
20 _ISOC99_SOURCE; or cc -std=c99
21 logbf(), logbl(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600
22 || _ISOC99_SOURCE; or cc -std=c99
23
25 These functions extract the exponent from the internal floating-point
26 representation of x and return it as a floating-point value. The inte‐
27 ger constant FLT_RADIX, defined in <float.h>, indicates the radix used
28 for the system's floating-point representation. If FLT_RADIX is 2,
29 logb(x) is equal to floor(log2(x)), except that it is probably faster.
30
31 If x is subnormal, logb() returns the exponent x would have if it were
32 normalized.
33
35 On success, these functions return the exponent of x.
36
37 If x is a NaN, a NaN is returned.
38
39 If x is zero, then a pole error occurs, and the functions return
40 -HUGE_VAL, -HUGE_VALF, or -HUGE_VALL, respectively.
41
42 If x is negative infinity or positive infinity, then positive infinity
43 is returned.
44
46 See math_error(7) for information on how to determine whether an error
47 has occurred when calling these functions.
48
49 The following errors can occur:
50
51 Pole error: x is 0
52 A divide-by-zero floating-point exception (FE_DIVBYZERO) is
53 raised.
54
55 These functions do not set errno.
56
58 C99, POSIX.1-2001.
59
61 ilogb(3), log(3)
62
64 This page is part of release 3.25 of the Linux man-pages project. A
65 description of the project, and information about reporting bugs, can
66 be found at http://www.kernel.org/doc/man-pages/.
67
68
69
70 2008-08-05 LOGB(3)