]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/ilogb.3
All pages: Remove the 5th argument to .TH
[thirdparty/man-pages.git] / 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 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\"
7 .\" Inspired by a page by Walter Harms created 2002-08-10
8 .\"
9 .TH ILOGB 3 2021-03-22 "Linux man-pages (unreleased)"
10 .SH NAME
11 ilogb, ilogbf, ilogbl \- get integer exponent of a floating-point value
12 .SH LIBRARY
13 Math library
14 .RI ( libm ", " \-lm )
15 .SH SYNOPSIS
16 .nf
17 .B #include <math.h>
18 .PP
19 .BI "int ilogb(double " x );
20 .BI "int ilogbf(float " x );
21 .BI "int ilogbl(long double " x );
22 .fi
23 .PP
24 .RS -4
25 Feature Test Macro Requirements for glibc (see
26 .BR feature_test_macros (7)):
27 .RE
28 .PP
29 .BR ilogb ():
30 .nf
31 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
32 || _XOPEN_SOURCE >= 500
33 .\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
34 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
35 || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
36 .fi
37 .PP
38 .BR ilogbf (),
39 .BR ilogbl ():
40 .nf
41 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
42 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
43 || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
44 .fi
45 .SH DESCRIPTION
46 These functions return the exponent part of their argument
47 as a signed integer.
48 When no error occurs, these functions
49 are equivalent to the corresponding
50 .BR logb (3)
51 functions, cast to
52 .IR int .
53 .SH RETURN VALUE
54 On success, these functions return the exponent of
55 .IR x ,
56 as a signed integer.
57 .PP
58 If
59 .I x
60 is zero, then a domain error occurs, and the functions return
61 .\" the POSIX.1 spec for logb() says logb() gives pole error for this
62 .\" case, but for ilogb() it says domain error.
63 .BR FP_ILOGB0 .
64 .\" glibc: The numeric value is either `INT_MIN' or `-INT_MAX'.
65 .PP
66 If
67 .I x
68 is a NaN, then a domain error occurs, and the functions return
69 .BR FP_ILOGBNAN .
70 .\" glibc: The numeric value is either `INT_MIN' or `INT_MAX'.
71 .\" On i386, FP_ILOGB0 and FP_ILOGBNAN have the same value.
72 .PP
73 If
74 .I x
75 is negative infinity or positive infinity, then
76 a domain error occurs, and the functions return
77 .BR INT_MAX .
78 .\"
79 .\" POSIX.1-2001 also says:
80 .\" If the correct value is greater than {INT_MAX}, {INT_MAX}
81 .\" shall be returned and a domain error shall occur.
82 .\"
83 .\" If the correct value is less than {INT_MIN}, {INT_MIN}
84 .\" shall be returned and a domain error shall occur.
85 .SH ERRORS
86 See
87 .BR math_error (7)
88 for information on how to determine whether an error has occurred
89 when calling these functions.
90 .PP
91 The following errors can occur:
92 .TP
93 Domain error: \fIx\fP is 0 or a NaN
94 An invalid floating-point exception
95 .RB ( FE_INVALID )
96 is raised, and
97 .I errno
98 is set to
99 .B EDOM
100 (but see BUGS).
101 .TP
102 Domain error: \fIx\fP is an infinity
103 An invalid floating-point exception
104 .RB ( FE_INVALID )
105 is raised, and
106 .I errno
107 is set to
108 .B EDOM
109 (but see BUGS).
110 .SH ATTRIBUTES
111 For an explanation of the terms used in this section, see
112 .BR attributes (7).
113 .ad l
114 .nh
115 .TS
116 allbox;
117 lbx lb lb
118 l l l.
119 Interface Attribute Value
120 T{
121 .BR ilogb (),
122 .BR ilogbf (),
123 .BR ilogbl ()
124 T} Thread safety MT-Safe
125 .TE
126 .hy
127 .ad
128 .sp 1
129 .SH STANDARDS
130 C99, POSIX.1-2001, POSIX.1-2008.
131 .SH BUGS
132 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6794
133 Before version 2.16, the following bugs existed in the
134 glibc implementation of these functions:
135 .IP * 3
136 The domain error case where
137 .I x
138 is 0 or a NaN did not cause
139 .I errno
140 to be set or (on some architectures) raise a floating-point exception.
141 .IP * 3
142 The domain error case where
143 .I x
144 is an infinity did not cause
145 .I errno
146 to be set or raise a floating-point exception.
147 .SH SEE ALSO
148 .BR log (3),
149 .BR logb (3),
150 .BR significand (3)