1 .\" Copyright 2004 Andries Brouwer <aeb@cwi.nl>.
2 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
3 .\" <mtk.manpages@gmail.com>
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
7 .\" Inspired by a page by Walter Harms created 2002-08-10
9 .TH ILOGB 3 2021-03-22 "Linux man-pages (unreleased)"
11 ilogb, ilogbf, ilogbl \- get integer exponent of a floating-point value
14 .RI ( libm ", " \-lm )
19 .BI "int ilogb(double " x );
20 .BI "int ilogbf(float " x );
21 .BI "int ilogbl(long double " x );
25 Feature Test Macro Requirements for glibc (see
26 .BR feature_test_macros (7)):
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
41 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
42 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
43 || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
46 These functions return the exponent part of their argument
48 When no error occurs, these functions
49 are equivalent to the corresponding
54 On success, these functions return the exponent of
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.
64 .\" glibc: The numeric value is either `INT_MIN' or `-INT_MAX'.
68 is a NaN, then a domain error occurs, and the functions return
70 .\" glibc: The numeric value is either `INT_MIN' or `INT_MAX'.
71 .\" On i386, FP_ILOGB0 and FP_ILOGBNAN have the same value.
75 is negative infinity or positive infinity, then
76 a domain error occurs, and the functions return
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.
83 .\" If the correct value is less than {INT_MIN}, {INT_MIN}
84 .\" shall be returned and a domain error shall occur.
88 for information on how to determine whether an error has occurred
89 when calling these functions.
91 The following errors can occur:
93 Domain error: \fIx\fP is 0 or a NaN
94 An invalid floating-point exception
102 Domain error: \fIx\fP is an infinity
103 An invalid floating-point exception
111 For an explanation of the terms used in this section, see
119 Interface Attribute Value
124 T} Thread safety MT-Safe
130 C99, POSIX.1-2001, POSIX.1-2008.
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:
136 The domain error case where
138 is 0 or a NaN did not cause
140 to be set or (on some architectures) raise a floating-point exception.
142 The domain error case where
144 is an infinity did not cause
146 to be set or raise a floating-point exception.