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