]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/logb.3
fuse.4: fuse_entry_out: rework discussion of uniqueness of nodeid + generation
[thirdparty/man-pages.git] / man3 / logb.3
1 .\" Copyright 2004 Andries Brouwer <aeb@cwi.nl>.
2 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
3 .\" <mtk.manpages@gmail.com>
4 .\"
5 .\" %%%LICENSE_START(VERBATIM)
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
9 .\"
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
14 .\"
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date. The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein. The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
21 .\" professionally.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" %%%LICENSE_END
26 .\"
27 .\" Inspired by a page by Walter Harms created 2002-08-10
28 .\"
29 .TH LOGB 3 2016-03-15 "" "Linux Programmer's Manual"
30 .SH NAME
31 logb, logbf, logbl \- get exponent of a floating-point value
32 .SH SYNOPSIS
33 .B #include <math.h>
34 .sp
35 .BI "double logb(double " x );
36 .br
37 .BI "float logbf(float " x );
38 .br
39 .BI "long double logbl(long double " x );
40 .sp
41 Link with \fI\-lm\fP.
42 .sp
43 .in -4n
44 Feature Test Macro Requirements for glibc (see
45 .BR feature_test_macros (7)):
46 .in
47 .sp
48 .ad l
49 .BR logb ():
50 .RS 4
51 _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
52 || _XOPEN_SOURCE\ >=\ 500
53 .\" || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
54 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
55 || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
56 .RE
57 .br
58 .BR logbf (),
59 .BR logbl ():
60 .RS 4
61 _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
62 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
63 || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
64 .RE
65 .ad b
66 .SH DESCRIPTION
67 These functions extract the exponent from the
68 internal floating-point representation of
69 .I x
70 and return it as a floating-point value.
71 The integer constant
72 .BR FLT_RADIX ,
73 defined in
74 .IR <float.h> ,
75 indicates the radix used for the system's floating-point representation.
76 If
77 .B FLT_RADIX
78 is 2,
79 .BI logb( x )
80 is equal to
81 .BI floor(log2( x ))\fR,
82 except that it is probably faster.
83 .LP
84 If
85 .I x
86 is subnormal,
87 .BR logb ()
88 returns the exponent
89 .I x
90 would have if it were normalized.
91 .SH RETURN VALUE
92 On success, these functions return the exponent of
93 .IR x .
94
95 If
96 .I x
97 is a NaN,
98 a NaN is returned.
99
100 If
101 .I x
102 is zero, then a pole error occurs, and the functions return
103 .RB - HUGE_VAL ,
104 .RB - HUGE_VALF ,
105 or
106 .RB - HUGE_VALL ,
107 respectively.
108
109 If
110 .I x
111 is negative infinity or positive infinity, then
112 positive infinity is returned.
113 .SH ERRORS
114 See
115 .BR math_error (7)
116 for information on how to determine whether an error has occurred
117 when calling these functions.
118 .PP
119 The following errors can occur:
120 .TP
121 Pole error: \fIx\fP is 0
122 .\" .I errno
123 .\" is set to
124 .\" .BR ERANGE .
125 A divide-by-zero floating-point exception
126 .RB ( FE_DIVBYZERO )
127 is raised.
128 .PP
129 These functions do not set
130 .IR errno .
131 .\" FIXME . Is it intentional that these functions do not set errno?
132 .\" log(), log2(), log10() do set errno
133 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6793
134 .\"
135 .\" .SH HISTORY
136 .\" The
137 .\" .BR logb ()
138 .\" function occurs in 4.3BSD.
139 .\" see IEEE.3 in the 4.3BSD manual
140 .SH ATTRIBUTES
141 For an explanation of the terms used in this section, see
142 .BR attributes (7).
143 .TS
144 allbox;
145 lbw24 lb lb
146 l l l.
147 Interface Attribute Value
148 T{
149 .BR logb (),
150 .BR logbf (),
151 .BR logbl ()
152 T} Thread safety MT-Safe
153 .TE
154 .SH CONFORMING TO
155 C99, POSIX.1-2001, POSIX.1-2008.
156 .SH SEE ALSO
157 .BR ilogb (3),
158 .BR log (3)