OSDN Git Service

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