Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / lib / msun / man / ieee.3
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 .\" 3. All advertising materials mentioning features or use of this software
13 .\"    must display the following acknowledgement:
14 .\"     This product includes software developed by the University of
15 .\"     California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\"    may be used to endorse or promote products derived from this software
18 .\"    without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\"     from: @(#)ieee.3        6.4 (Berkeley) 5/6/91
33 .\" $FreeBSD: src/lib/msun/man/ieee.3,v 1.5.2.5 2001/12/17 10:08:36 ru Exp $
34 .\" $DragonFly: src/lib/msun/man/Attic/ieee.3,v 1.2 2003/06/17 04:26:52 dillon Exp $
35 .\"
36 .Dd February 25, 1994
37 .Dt IEEE 3
38 .Os
39 .Sh NAME
40 .Nm copysign ,
41 .Nm copysignf ,
42 .Nm finite ,
43 .Nm finitef ,
44 .Nm ilogb ,
45 .Nm ilogbf ,
46 .Nm nextafter ,
47 .Nm nextafterf ,
48 .Nm remainder ,
49 .Nm remainderf ,
50 .Nm scalbn ,
51 .Nm scalbnf
52 .Nd functions for IEEE arithmetic
53 .Sh LIBRARY
54 .Lb libm
55 .Sh SYNOPSIS
56 .In math.h
57 .Ft double
58 .Fn copysign "double x" "double y"
59 .Ft float
60 .Fn copysignf "float x" "float y"
61 .Ft int
62 .Fn finite "double x"
63 .Ft int
64 .Fn finitef "float x"
65 .Ft int
66 .Fn ilogb "double x"
67 .Ft int
68 .Fn ilogbf "float x"
69 .Ft double
70 .Fn nextafter "double x" "double y"
71 .Ft float
72 .Fn nextafterf "float x" "float y"
73 .Ft double
74 .Fn remainder "double x" "double y"
75 .Ft float
76 .Fn remainderf "float x" "float y"
77 .Ft double
78 .Fn scalbn "double x" "int n"
79 .Ft float
80 .Fn scalbnf "float x" "int n"
81 .Sh DESCRIPTION
82 These functions are required or recommended by
83 .St -ieee754 .
84 .Pp
85 .Fn copysign
86 and
87 .Fn copysignf
88 return
89 .Fa x
90 with its sign changed to
91 .Fa y Ns 's .
92 .Pp
93 .Fn finite
94 and
95 .Fn finitef
96 return the value 1 just when
97 \-\*(If \*(Lt
98 .Fa x
99 \*(Lt +\*(If;
100 otherwise a
101 zero is returned
102 (when
103 .Pf \\*(Ba Ns Fa x Ns \\*(Ba
104 = \*(If or
105 .Fa x
106 is \*(Na).
107 .Pp
108 .Fn ilogb
109 and
110 .Fn ilogbf
111 return
112 .Fa x Ns 's exponent,
113 in integer format.
114 .Fn ilogb \*(Pm\*(If
115 returns
116 .Dv INT_MAX
117 and
118 .Fn ilogb 0
119 returns
120 .Dv INT_MIN .
121 .Pp
122 .Fn nextafter
123 and
124 .Fn nextafterf
125 return the next machine representable number from
126 .Fa x
127 in direction
128 .Fa y .
129 .Pp
130 .Fn remainder
131 and
132 .Fn remainderf
133 return the remainder
134 .Fa r
135 :=
136 .Fa x
137 \-
138 .Fa n\(**y
139 where
140 .Fa n
141 is the integer nearest the exact value of
142 .Bk -words
143 .Fa x Ns / Ns Fa y ;
144 .Ek
145 moreover if
146 .Pf \\*(Ba Fa n
147 \-
148 .Sm off
149 .Fa x No / Fa y No \\*(Ba
150 .Sm on
151 =
152 1/2
153 then
154 .Fa n
155 is even.  Consequently
156 the remainder is computed exactly and
157 .Sm off
158 .Pf \\*(Ba Fa r No \\*(Ba
159 .Sm on
160 \*(Le
161 .Sm off
162 .Pf \\*(Ba Fa y No \\*(Ba/2 .
163 .Sm on
164 But
165 .Fn remainder x 0
166 and
167 .Fn remainder \*(If 0
168 are invalid operations that produce a \*(Na.
169 .Pp
170 .Fn scalbn
171 and
172 .Fn scalbnf
173 return
174 .Fa x Ns \(**(2** Ns Fa n )
175 computed by exponent manipulation.
176 .Sh SEE ALSO
177 .Xr math 3
178 .Sh HISTORY
179 The
180 .Nm ieee
181 functions appeared in
182 .Bx 4.3 .
183 .Sh STANDARDS
184 .St -ieee754