]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/fmod.3
acos.3, acosh.3, asin.3, asinh.3, atan.3, atan2.3, atanh.3, cabs.3, cacos.3, cacosh...
[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.\"
fe0fefbf 35.TH FMOD 3 2015-03-02 "" "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
8b0d34e4
MK
60_BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
61_POSIX_C_SOURCE\ >=\ 200112L;
b90c43a8
MK
62.br
63or
1cc72c09 64.I cc\ -std=c99
b90c43a8
MK
65.RE
66.ad
fea681da 67.SH DESCRIPTION
5600f73a 68These functions compute the floating-point remainder of dividing
022671eb
MK
69.I x
70by
71.IR y .
72The return value is
51700fd7 73.IR x
022671eb
MK
74\-
75.I n
76*
77.IR y ,
78where
79.I n
80is the quotient of
81.I x
82/
83.IR y ,
84rounded toward zero to an integer.
47297adb 85.SH RETURN VALUE
1cc72c09
MK
86On success, these
87functions return the value \fIx\fP\ \-\ \fIn\fP*\fIy\fP,
022671eb
MK
88for some integer
89.IR n ,
1cc72c09
MK
90such that the returned value has the same sign as
91.I x
92and a magnitude less than the magnitude of
93.IR y .
94
95If
96.I x
97or
98.I y
99is a NaN, a NaN is returned.
100
101If
102.I x
385cf745 103is an infinity,
efe294cb 104a domain error occurs, and
1cc72c09
MK
105a NaN is returned.
106
107If
108.I y
109is zero,
efe294cb 110a domain error occurs, and
1cc72c09
MK
111a NaN is returned.
112
113If
114.I x
115is +0 (\-0), and
116.I y
117is not zero, +0 (\-0) is returned.
fea681da 118.SH ERRORS
1cc72c09
MK
119See
120.BR math_error (7)
121for information on how to determine whether an error has occurred
122when calling these functions.
123.PP
124The following errors can occur:
125.TP
126Domain error: \fIx\fP is an infinity
9343357b
MK
127.I errno
128is set to
129.BR EDOM
130(but see BUGS).
1cc72c09
MK
131An invalid floating-point exception
132.RB ( FE_INVALID )
133is raised.
fea681da 134.TP
1cc72c09
MK
135Domain error: \fIy\fP is zero
136.I errno
137is set to
138.BR EDOM .
139An invalid floating-point exception
140.RB ( FE_INVALID )
141is raised.
142.\" POSIX.1 documents an optional underflow error, but AFAICT it doesn't
143.\" (can't?) occur -- mtk, Jul 2008
86576222
MS
144.SH ATTRIBUTES
145For an explanation of the terms used in this section, see
146.BR attributes (7).
147.TS
148allbox;
149lbw24 lb lb
150l l l.
151Interface Attribute Value
152T{
153.BR fmod (),
154.BR fmodf (),
155.BR fmodl ()
156T} Thread safety MT-Safe
157.TE
47297adb 158.SH CONFORMING TO
9a74e018 159C99, POSIX.1-2001, POSIX.1-2008.
e05e3635 160
22cb459d
MK
161The variant returning
162.I double
163also conforms to
164SVr4, 4.3BSD, C89.
9343357b
MK
165.SH BUGS
166Before version 2.10, the glibc implementation did not set
167.\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=6784
168.I errno
169to
170.B EDOM
171when a domain error occurred for an infinite
172.IR x .
47297adb 173.SH SEE ALSO
fea681da 174.BR remainder (3)