]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/remainder.3
Where there is an instruction in the SYNOPIS about linking
[thirdparty/man-pages.git] / man3 / remainder.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" References consulted:
24 .\" Linux libc source code
25 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
26 .\" 386BSD man pages
27 .\"
28 .\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu)
29 .\" Modified 2002-08-10 Walter Harms
30 .\" (walter.harms@informatik.uni-oldenburg.de)
31 .\" Modified 2003-11-18, 2004-10-05 aeb
32 .\"
33 .TH REMAINDER 3 2003-11-18 "" "Linux Programmer's Manual"
34 .SH NAME
35 drem, dremf, dreml, remainder, remainderf, remainderl \- \
36 floating-point remainder function
37 .SH SYNOPSIS
38 .nf
39 .B #include <math.h>
40 .sp
41 /* The C99 versions */
42 .BI "double remainder(double " x ", double " y );
43 .BI "float remainderf(float " x ", float " y );
44 .BI "long double remainderl(long double " x ", long double " y );
45 .sp
46 /* Obsolete synonyms */
47 .BI "double drem(double " x ", double " y );
48 .BI "float dremf(float " x ", float " y );
49 .BI "long double dreml(long double " x ", long double " y );
50 .sp
51 .fi
52 Link with \fI-lm\fP.
53 .SH DESCRIPTION
54 The
55 .BR remainder ()
56 function computes the remainder of dividing
57 .I x
58 by
59 .IR y .
60 The return value is
61 .IR x " \- " n " * " y ,
62 where
63 .I n
64 is the value
65 .IR x " / " y ,
66 rounded to the nearest integer.
67 If this quotient is 1/2 (mod 1), it is rounded to the nearest even number
68 (independent of the current rounding mode).
69 If the return value is 0, it has the sign of
70 .IR x .
71 .LP
72 The
73 .BR drem ()
74 function does precisely the same thing.
75 .SH "RETURN VALUE"
76 The
77 .BR remainder ()
78 function returns the remainder, unless
79 .I y
80 is zero, when the function fails and
81 .I errno
82 is set.
83 .SH ERRORS
84 .TP
85 .B EDOM
86 The denominator
87 .I y
88 is zero.
89 .SH "CONFORMING TO"
90 IEC 60559.
91 The functions
92 .BR remainder (),
93 .BR remainderf (),
94 and
95 .BR remainderl ()
96 are from C99.
97 The function
98 .BR drem ()
99 is from 4.3BSD.
100 The
101 .I float
102 and
103 .I "long double"
104 variants
105 .BR dremf ()
106 and
107 .BR dreml ()
108 exist on some systems, such as Tru64 and glibc2.
109 .SH EXAMPLE
110 The call "remainder(29.0, 3.0)" returns \-1.
111 .SH "SEE ALSO"
112 .BR fmod (3),
113 .BR remquo (3)