xref: /freebsd/lib/msun/man/remainder.3 (revision dc36d6f9bb1753f3808552f3afd30eda9a7b206a)
129bf6af8SDavid Schultz.\" Copyright (c) 1985, 1991 Regents of the University of California.
229bf6af8SDavid Schultz.\" All rights reserved.
329bf6af8SDavid Schultz.\"
429bf6af8SDavid Schultz.\" Redistribution and use in source and binary forms, with or without
529bf6af8SDavid Schultz.\" modification, are permitted provided that the following conditions
629bf6af8SDavid Schultz.\" are met:
729bf6af8SDavid Schultz.\" 1. Redistributions of source code must retain the above copyright
829bf6af8SDavid Schultz.\"    notice, this list of conditions and the following disclaimer.
929bf6af8SDavid Schultz.\" 2. Redistributions in binary form must reproduce the above copyright
1029bf6af8SDavid Schultz.\"    notice, this list of conditions and the following disclaimer in the
1129bf6af8SDavid Schultz.\"    documentation and/or other materials provided with the distribution.
12*fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors
1329bf6af8SDavid Schultz.\"    may be used to endorse or promote products derived from this software
1429bf6af8SDavid Schultz.\"    without specific prior written permission.
1529bf6af8SDavid Schultz.\"
1629bf6af8SDavid Schultz.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1729bf6af8SDavid Schultz.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1829bf6af8SDavid Schultz.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1929bf6af8SDavid Schultz.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2029bf6af8SDavid Schultz.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2129bf6af8SDavid Schultz.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2229bf6af8SDavid Schultz.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2329bf6af8SDavid Schultz.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2429bf6af8SDavid Schultz.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2529bf6af8SDavid Schultz.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2629bf6af8SDavid Schultz.\" SUCH DAMAGE.
2729bf6af8SDavid Schultz.\"
28c7392feeSDavid Schultz.Dd March 30, 2008
2929bf6af8SDavid Schultz.Dt REMAINDER 3
3029bf6af8SDavid Schultz.Os
3129bf6af8SDavid Schultz.Sh NAME
3229bf6af8SDavid Schultz.Nm remainder ,
333b9141eeSDavid Schultz.Nm remainderf ,
34c7392feeSDavid Schultz.Nm remainderl ,
353b9141eeSDavid Schultz.Nm remquo ,
36c7392feeSDavid Schultz.Nm remquof ,
37c7392feeSDavid Schultz.Nm remquol
3829bf6af8SDavid Schultz.Nd minimal residue functions
3929bf6af8SDavid Schultz.Sh LIBRARY
4029bf6af8SDavid Schultz.Lb libm
4129bf6af8SDavid Schultz.Sh SYNOPSIS
4229bf6af8SDavid Schultz.In math.h
4329bf6af8SDavid Schultz.Ft double
4429bf6af8SDavid Schultz.Fn remainder "double x" "double y"
4529bf6af8SDavid Schultz.Ft float
4629bf6af8SDavid Schultz.Fn remainderf "float x" "float y"
47c7392feeSDavid Schultz.Ft long double
48c7392feeSDavid Schultz.Fn remainderl "long double x" "long double y"
493b9141eeSDavid Schultz.Ft double
503b9141eeSDavid Schultz.Fn remquo "double x" "double y" "int *quo"
513b9141eeSDavid Schultz.Ft float
52053d1689SBruce Evans.Fn remquof "float x" "float y" "int *quo"
53c7392feeSDavid Schultz.Ft long double
54c7392feeSDavid Schultz.Fn remquol "long double x" "long double y" "int *quo"
5529bf6af8SDavid Schultz.Sh DESCRIPTION
563b9141eeSDavid Schultz.Fn remainder ,
573b9141eeSDavid Schultz.Fn remainderf ,
58c7392feeSDavid Schultz.Fn remainderl ,
593b9141eeSDavid Schultz.Fn remquo ,
60c7392feeSDavid Schultz.Fn remquof ,
6129bf6af8SDavid Schultzand
62c7392feeSDavid Schultz.Fn remquol
6329bf6af8SDavid Schultzreturn the remainder
6429bf6af8SDavid Schultz.Fa r
6529bf6af8SDavid Schultz:=
6629bf6af8SDavid Schultz.Fa x
6729bf6af8SDavid Schultz\-
6829bf6af8SDavid Schultz.Fa n\(**y
6929bf6af8SDavid Schultzwhere
7029bf6af8SDavid Schultz.Fa n
7129bf6af8SDavid Schultzis the integer nearest the exact value of
7229bf6af8SDavid Schultz.Bk -words
7329bf6af8SDavid Schultz.Fa x Ns / Ns Fa y ;
7429bf6af8SDavid Schultz.Ek
7529bf6af8SDavid Schultzmoreover if
76e3303e90SUlrich Spörlein.Pf \*(Ba Fa n
7729bf6af8SDavid Schultz\-
7829bf6af8SDavid Schultz.Sm off
79e3303e90SUlrich Spörlein.Fa x No / Fa y No \*(Ba
8029bf6af8SDavid Schultz.Sm on
8129bf6af8SDavid Schultz=
8229bf6af8SDavid Schultz1/2
8329bf6af8SDavid Schultzthen
8429bf6af8SDavid Schultz.Fa n
8529bf6af8SDavid Schultzis even.
8629bf6af8SDavid SchultzConsequently
8729bf6af8SDavid Schultzthe remainder is computed exactly and
8829bf6af8SDavid Schultz.Sm off
89e3303e90SUlrich Spörlein.Pf \*(Ba Fa r No \*(Ba
9029bf6af8SDavid Schultz.Sm on
9129bf6af8SDavid Schultz\*(Le
9229bf6af8SDavid Schultz.Sm off
93e3303e90SUlrich Spörlein.Pf \*(Ba Fa y No \*(Ba/2 .
9429bf6af8SDavid Schultz.Sm on
953b9141eeSDavid SchultzBut attempting to take the remainder when
963b9141eeSDavid Schultz.Fa y
973b9141eeSDavid Schultzis 0 or
983b9141eeSDavid Schultz.Fa x
993b9141eeSDavid Schultzis \*(Pm\*(If is an invalid operation that produces a \*(Na.
1003b9141eeSDavid Schultz.Pp
1013b9141eeSDavid SchultzThe
102c7392feeSDavid Schultz.Fn remquo ,
103c7392feeSDavid Schultz.Fn remquof ,
10429bf6af8SDavid Schultzand
105c7392feeSDavid Schultz.Fn remquol
1063b9141eeSDavid Schultzfunctions also store the last
1073b9141eeSDavid Schultz.Va k
1083b9141eeSDavid Schultzbits of
1093b9141eeSDavid Schultz.Fa n
1103b9141eeSDavid Schultzin the location pointed to by
1113b9141eeSDavid Schultz.Fa quo ,
1123b9141eeSDavid Schultzprovided that
1133b9141eeSDavid Schultz.Fa n
1143b9141eeSDavid Schultzexists.
1153b9141eeSDavid SchultzThe number of bits
1163b9141eeSDavid Schultz.Va k
1173b9141eeSDavid Schultzis platform-specific, but is guaranteed to be at least 3.
11829bf6af8SDavid Schultz.Sh SEE ALSO
11929bf6af8SDavid Schultz.Xr fmod 3 ,
12029bf6af8SDavid Schultz.Xr ieee 3 ,
12129bf6af8SDavid Schultz.Xr math 3
12229bf6af8SDavid Schultz.Sh STANDARDS
12329bf6af8SDavid SchultzThe
1243b9141eeSDavid Schultz.Fn remainder ,
1253b9141eeSDavid Schultz.Fn remainderf ,
126c7392feeSDavid Schultz.Fn remainderl ,
1273b9141eeSDavid Schultz.Fn remquo ,
128c7392feeSDavid Schultz.Fn remquof ,
12929bf6af8SDavid Schultzand
130c7392feeSDavid Schultz.Fn remquol
13129bf6af8SDavid Schultzroutines conform to
1323b9141eeSDavid Schultz.St -isoC-99 .
1333b9141eeSDavid SchultzThe remainder is as defined in
13429bf6af8SDavid Schultz.St -ieee754 .
13529bf6af8SDavid Schultz.Sh HISTORY
13629bf6af8SDavid SchultzThe
13729bf6af8SDavid Schultz.Fn remainder
13829bf6af8SDavid Schultzand
13929bf6af8SDavid Schultz.Fn remainderf
14029bf6af8SDavid Schultzfunctions appeared in
14129bf6af8SDavid Schultz.Bx 4.3
14229bf6af8SDavid Schultzand
14329bf6af8SDavid Schultz.Fx 2.0 ,
14429bf6af8SDavid Schultzrespectively.
1453b9141eeSDavid SchultzThe
1463b9141eeSDavid Schultz.Fn remquo
1473b9141eeSDavid Schultzand
1483b9141eeSDavid Schultz.Fn remquof
1493b9141eeSDavid Schultzfunctions were added in
150c7392feeSDavid Schultz.Fx 6.0 ,
151c7392feeSDavid Schultzand
152c7392feeSDavid Schultz.Fn remainderl
153c7392feeSDavid Schultzand
154c7392feeSDavid Schultz.Fn remquol
155c7392feeSDavid Schultzwere added in
156c7392feeSDavid Schultz.Fx 8.0 .
157