]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/fmod.3
libc.7: Add a note on why glibc 2.x uses the soname libc.so.6
[thirdparty/man-pages.git] / man3 / fmod.3
CommitLineData
fea681da 1.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
1cc72c09
MK
2.\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
3.\" <mtk.manpages@gmail.com>
fea681da 4.\"
93015253 5.\" %%%LICENSE_START(VERBATIM)
fea681da
MK
6.\" Permission is granted to make and distribute verbatim copies of this
7.\" manual provided the copyright notice and this permission notice are
8.\" preserved on all copies.
9.\"
10.\" Permission is granted to copy and distribute modified versions of this
11.\" manual under the conditions for verbatim copying, provided that the
12.\" entire resulting derived work is distributed under the terms of a
13.\" permission notice identical to this one.
c13182ef 14.\"
fea681da
MK
15.\" Since the Linux kernel and libraries are constantly changing, this
16.\" manual page may be incorrect or out-of-date. The author(s) assume no
17.\" responsibility for errors or omissions, or for damages resulting from
18.\" the use of the information contained herein. The author(s) may not
19.\" have taken the same level of care in the production of this manual,
20.\" which is licensed free of charge, as they might when working
21.\" professionally.
c13182ef 22.\"
fea681da
MK
23.\" Formatted or processed versions of this manual, if unaccompanied by
24.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 25.\" %%%LICENSE_END
fea681da
MK
26.\"
27.\" References consulted:
28.\" Linux libc source code
29.\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
30.\" 386BSD man pages
31.\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu)
32.\" Modified 2002-07-27 by Walter Harms
33.\" (walter.harms@informatik.uni-oldenburg.de)
34.\"
97986708 35.TH FMOD 3 2016-03-15 "" "Linux Programmer's Manual"
fea681da
MK
36.SH NAME
37fmod, fmodf, fmodl \- floating-point remainder function
38.SH SYNOPSIS
39.nf
40.B #include <math.h>
41.sp
42.BI "double fmod(double " x ", double " y );
d39541ec 43.br
fea681da 44.BI "float fmodf(float " x ", float " y );
d39541ec 45.br
fea681da
MK
46.BI "long double fmodl(long double " x ", long double " y );
47.fi
48.sp
20c58d70 49Link with \fI\-lm\fP.
1cc72c09
MK
50.sp
51.in -4n
52Feature Test Macro Requirements for glibc (see
53.BR feature_test_macros (7)):
54.in
55.sp
56.ad l
57.BR fmodf (),
58.BR fmodl ():
b90c43a8 59.RS 4
e9d91bcf
MK
60_ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
61 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
62 || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
b90c43a8
MK
63.RE
64.ad
fea681da 65.SH DESCRIPTION
5600f73a 66These functions compute the floating-point remainder of dividing
022671eb
MK
67.I x
68by
69.IR y .
70The return value is
51700fd7 71.IR x
022671eb
MK
72\-
73.I n
74*
75.IR y ,
76where
77.I n
78is the quotient of
79.I x
80/
81.IR y ,
82rounded toward zero to an integer.
47297adb 83.SH RETURN VALUE
1cc72c09
MK
84On success, these
85functions return the value \fIx\fP\ \-\ \fIn\fP*\fIy\fP,
022671eb
MK
86for some integer
87.IR n ,
1cc72c09
MK
88such that the returned value has the same sign as
89.I x
90and a magnitude less than the magnitude of
91.IR y .
92
93If
94.I x
95or
96.I y
97is a NaN, a NaN is returned.
98
99If
100.I x
385cf745 101is an infinity,
efe294cb 102a domain error occurs, and
1cc72c09
MK
103a NaN is returned.
104
105If
106.I y
107is zero,
efe294cb 108a domain error occurs, and
1cc72c09
MK
109a NaN is returned.
110
111If
112.I x
113is +0 (\-0), and
114.I y
115is not zero, +0 (\-0) is returned.
fea681da 116.SH ERRORS
1cc72c09
MK
117See
118.BR math_error (7)
119for information on how to determine whether an error has occurred
120when calling these functions.
121.PP
122The following errors can occur:
123.TP
124Domain error: \fIx\fP is an infinity
9343357b
MK
125.I errno
126is set to
127.BR EDOM
128(but see BUGS).
1cc72c09
MK
129An invalid floating-point exception
130.RB ( FE_INVALID )
131is raised.
fea681da 132.TP
1cc72c09
MK
133Domain error: \fIy\fP is zero
134.I errno
135is set to
136.BR EDOM .
137An invalid floating-point exception
138.RB ( FE_INVALID )
139is raised.
140.\" POSIX.1 documents an optional underflow error, but AFAICT it doesn't
141.\" (can't?) occur -- mtk, Jul 2008
86576222
MS
142.SH ATTRIBUTES
143For an explanation of the terms used in this section, see
144.BR attributes (7).
145.TS
146allbox;
147lbw24 lb lb
148l l l.
149Interface Attribute Value
150T{
151.BR fmod (),
152.BR fmodf (),
153.BR fmodl ()
154T} Thread safety MT-Safe
155.TE
47297adb 156.SH CONFORMING TO
9a74e018 157C99, POSIX.1-2001, POSIX.1-2008.
e05e3635 158
22cb459d
MK
159The variant returning
160.I double
161also conforms to
162SVr4, 4.3BSD, C89.
9343357b
MK
163.SH BUGS
164Before version 2.10, the glibc implementation did not set
165.\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=6784
166.I errno
167to
168.B EDOM
169when a domain error occurred for an infinite
170.IR x .
47297adb 171.SH SEE ALSO
fea681da 172.BR remainder (3)