OSDN Git Service

(split) LDP_man-pages: update original to v3.35.
[linuxjm/LDP_man-pages.git] / original / man3 / ilogb.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 ILOGB 3 2010-09-20 "" "Linux Programmer's Manual"
28 .SH NAME
29 ilogb, ilogbf, ilogbl \- get integer exponent of a floating-point value
30 .SH SYNOPSIS
31 .B #include <math.h>
32 .sp
33 .BI "int ilogb(double " x );
34 .br
35 .BI "int ilogbf(float " x );
36 .br
37 .BI "int ilogbl(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 ilogb ():
48 .RS 4
49 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
50 _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED ||
51 _ISOC99_SOURCE ||
52 _POSIX_C_SOURCE\ >=\ 200112L;
53 .br
54 or
55 .I cc\ -std=c99
56 .RE
57 .br
58 .BR ilogbf (),
59 .BR ilogbl ():
60 .RS 4
61 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
62 _POSIX_C_SOURCE\ >=\ 200112L;
63 .br
64 or
65 .I cc\ -std=c99
66 .RE
67 .ad b
68 .SH DESCRIPTION
69 These functions return the exponent part of their argument
70 as a signed integer.
71 When no error occurs, these functions
72 are equivalent to the corresponding
73 .BR logb (3)
74 functions, cast to
75 .IR int .
76 .SH RETURN VALUE
77 On success, these functions return the exponent of
78 .IR x ,
79 as a signed integer.
80
81 If
82 .I x
83 is zero, then a domain error occurs, and the functions return
84 .\" the POSIX.1 spec for logb() says logb() gives pole error for this
85 .\" case, but for ilogb() it says domain error.
86 .BR FP_ILOGB0 .
87 .\" glibc: The numeric value is either `INT_MIN' or `-INT_MAX'.
88
89 If
90 .I x
91 is a NaN, then a domain error occurs, and the functions return
92 .BR FP_ILOGBNAN .
93 .\" glibc: The numeric value is either `INT_MIN' or `INT_MAX'.
94 .\" On i386, FP_ILOGB0 and FP_ILOGBNAN have the same value.
95
96 If
97 .I x
98 is negative infinity or positive infinity, then
99 a domain error occurs, and the functions return
100 .BR INT_MAX .
101 .\"
102 .\" POSIX.1-2001 also says:
103 .\" If the correct value is greater than {INT_MAX}, {INT_MAX}
104 .\" shall be returned and a domain error shall occur.
105 .\"
106 .\" If the correct value is less than {INT_MIN}, {INT_MIN}
107 .\" shall be returned and a domain error shall occur.
108 .SH ERRORS
109 See
110 .BR math_error (7)
111 for information on how to determine whether an error has occurred
112 when calling these functions.
113 .PP
114 The following errors can occur:
115 .TP
116 Domain error: \fIx\fP is 0 or a NaN
117 .\" .I errno
118 .\" is set to
119 .\" .BR EDOM .
120 An invalid floating-point exception
121 .RB ( FE_INVALID )
122 is raised.
123 .IP
124 These functions do not set
125 .IR errno
126 for this case.
127 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6794
128 .TP
129 Domain error: \fIx\fP is an infinity
130 .\" .I errno
131 .\" is set to
132 .\" .BR EDOM .
133 .\" An invalid floating-point exception
134 .\" .RB ( FE_INVALID )
135 .\" is raised.
136 .IP
137 These functions do not set
138 .IR errno
139 or raise an exception for this case.
140 .\" FIXME . Is it intentional that these functions do not set errno,
141 .\" or raise an exception?
142 .\" log(), log2(), log10() do set errno
143 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6794
144 .SH "CONFORMING TO"
145 C99, POSIX.1-2001.
146 .SH "SEE ALSO"
147 .BR log (3),
148 .BR logb (3),
149 .BR significand (3)