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