xref: /freebsd/lib/msun/man/ilogb.3 (revision 0b3105a37d7adcadcb720112fed4dc4e8040be99)
1.\" Copyright (c) 1985, 1991 Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 4. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.\"     from: @(#)ieee.3	6.4 (Berkeley) 5/6/91
29.\" $FreeBSD$
30.\"
31.Dd December 16, 2007
32.Dt ILOGB 3
33.Os
34.Sh NAME
35.Nm ilogb ,
36.Nm ilogbf ,
37.Nm ilogbl ,
38.Nm logb ,
39.Nm logbf ,
40.Nm logbl
41.Nd extract exponent
42.Sh LIBRARY
43.Lb libm
44.Sh SYNOPSIS
45.In math.h
46.Ft int
47.Fn ilogb "double x"
48.Ft int
49.Fn ilogbf "float x"
50.Ft int
51.Fn ilogbl "long double x"
52.Ft double
53.Fn logb "double x"
54.Ft float
55.Fn logbf "float x"
56.Ft long double
57.Fn logbl "long double x"
58.Sh DESCRIPTION
59.Fn ilogb ,
60.Fn ilogbf
61and
62.Fn ilogbl
63return
64.Fa x Ns 's exponent
65in integer format.
66.Fn ilogb \*(Pm\*(If
67returns
68.Dv INT_MAX ,
69.Fn ilogb \*(Pm\*(Na
70returns
71.Dv FP_ILOGBNAN ,
72and
73.Fn ilogb 0
74returns
75.Dv FP_ILOGB0 .
76.Pp
77.Fn logb x ,
78.Fn logbf x ,
79and
80.Fn logbl x
81return
82.Fa x Ns 's exponent
83in floating\-point format with the same precision as
84.Fa x .
85.Fn logb \*(Pm\*(If
86returns +\*(If, and
87.Fn logb 0
88returns -\*(If with a division by zero exception.
89.Sh SEE ALSO
90.Xr frexp 3 ,
91.Xr ieee 3 ,
92.Xr math 3 ,
93.Xr scalbn 3
94.Sh STANDARDS
95The
96.Fn ilogb ,
97.Fn ilogbf ,
98.Fn ilogbl ,
99.Fn logb ,
100.Fn logbf ,
101and
102.Fn logbl
103routines conform to
104.St -isoC-99 .
105The latter three
106implement the logb function recommended by
107.St -ieee754 .
108.Sh HISTORY
109.Bl -tag -width "Function " -compact
110.It Em Function
111.Em "First Appeared In"
112.It Fn logb
113.Bx 4.3
114.It Fn ilogb
115.Fx 1.1.5
116.It Fn ilogbf
117.Fx 2.0
118.It Fn logbf
119.Fx 2.0
120.It Fn ilogbl
121.Fx 5.4
122.It Fn logbl
123.Fx 8.0
124.El
125