]> CyberLeo.Net >> Repos - FreeBSD/releng/7.2.git/blob - lib/msun/man/remainder.3
Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.
[FreeBSD/releng/7.2.git] / lib / msun / man / remainder.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 .\" 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 March 24, 2005
32 .Dt REMAINDER 3
33 .Os
34 .Sh NAME
35 .Nm remainder ,
36 .Nm remainderf ,
37 .Nm remquo ,
38 .Nm remquof
39 .Nd minimal residue functions
40 .Sh LIBRARY
41 .Lb libm
42 .Sh SYNOPSIS
43 .In math.h
44 .Ft double
45 .Fn remainder "double x" "double y"
46 .Ft float
47 .Fn remainderf "float x" "float y"
48 .Ft double
49 .Fn remquo "double x" "double y" "int *quo"
50 .Ft float
51 .Fn remquof "float x" "float y" "int *quo"
52 .Sh DESCRIPTION
53 .Fn remainder ,
54 .Fn remainderf ,
55 .Fn remquo ,
56 and
57 .Fn remquof
58 return the remainder
59 .Fa r
60 :=
61 .Fa x
62 \-
63 .Fa n\(**y
64 where
65 .Fa n
66 is the integer nearest the exact value of
67 .Bk -words
68 .Fa x Ns / Ns Fa y ;
69 .Ek
70 moreover if
71 .Pf \\*(Ba Fa n
72 \-
73 .Sm off
74 .Fa x No / Fa y No \\*(Ba
75 .Sm on
76 =
77 1/2
78 then
79 .Fa n
80 is even.
81 Consequently
82 the remainder is computed exactly and
83 .Sm off
84 .Pf \\*(Ba Fa r No \\*(Ba
85 .Sm on
86 \*(Le
87 .Sm off
88 .Pf \\*(Ba Fa y No \\*(Ba/2 .
89 .Sm on
90 But attempting to take the remainder when
91 .Fa y
92 is 0 or
93 .Fa x
94 is \*(Pm\*(If is an invalid operation that produces a \*(Na.
95 .Pp
96 The
97 .Fn remquo
98 and
99 .Fn remquof
100 functions also store the last
101 .Va k
102 bits of
103 .Fa n
104 in the location pointed to by
105 .Fa quo ,
106 provided that
107 .Fa n
108 exists.
109 The number of bits
110 .Va k
111 is platform-specific, but is guaranteed to be at least 3.
112 .Sh SEE ALSO
113 .Xr fmod 3 ,
114 .Xr ieee 3 ,
115 .Xr math 3
116 .Sh STANDARDS
117 The
118 .Fn remainder ,
119 .Fn remainderf ,
120 .Fn remquo ,
121 and
122 .Fn remquof
123 routines conform to
124 .St -isoC-99 .
125 The remainder is as defined in
126 .St -ieee754 .
127 .Sh HISTORY
128 The
129 .Fn remainder
130 and
131 .Fn remainderf
132 functions appeared in
133 .Bx 4.3
134 and
135 .Fx 2.0 ,
136 respectively.
137 The
138 .Fn remquo
139 and
140 .Fn remquof
141 functions were added in
142 .Fx 6.0 .