]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/fmod.3
Many pages: Use correct letter case in page titles (TH)
[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.\"
5fbde956 5.\" SPDX-License-Identifier: Linux-man-pages-copyleft
fea681da
MK
6.\"
7.\" References consulted:
8.\" Linux libc source code
9.\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
10.\" 386BSD man pages
11.\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu)
12.\" Modified 2002-07-27 by Walter Harms
13.\" (walter.harms@informatik.uni-oldenburg.de)
14.\"
4c1c5274 15.TH fmod 3 (date) "Linux man-pages (unreleased)"
fea681da
MK
16.SH NAME
17fmod, fmodf, fmodl \- floating-point remainder function
2af19291
AC
18.SH LIBRARY
19Math library
8fc3b2cf 20.RI ( libm ", " \-lm )
fea681da
MK
21.SH SYNOPSIS
22.nf
23.B #include <math.h>
68e4db0a 24.PP
fea681da 25.BI "double fmod(double " x ", double " y );
fea681da 26.BI "float fmodf(float " x ", float " y );
fea681da
MK
27.BI "long double fmodl(long double " x ", long double " y );
28.fi
68e4db0a 29.PP
d39ad78f 30.RS -4
1cc72c09
MK
31Feature Test Macro Requirements for glibc (see
32.BR feature_test_macros (7)):
d39ad78f 33.RE
68e4db0a 34.PP
1cc72c09
MK
35.BR fmodf (),
36.BR fmodl ():
9d2adbae 37.nf
5c10d2c5 38 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
9d2adbae
MK
39 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
40 || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
41.fi
fea681da 42.SH DESCRIPTION
5600f73a 43These functions compute the floating-point remainder of dividing
022671eb
MK
44.I x
45by
46.IR y .
47The return value is
1ae6b2c7 48.I x
022671eb
MK
49\-
50.I n
51*
52.IR y ,
53where
54.I n
55is the quotient of
56.I x
57/
58.IR y ,
59rounded toward zero to an integer.
47297adb 60.SH RETURN VALUE
1cc72c09
MK
61On success, these
62functions return the value \fIx\fP\ \-\ \fIn\fP*\fIy\fP,
022671eb
MK
63for some integer
64.IR n ,
1cc72c09
MK
65such that the returned value has the same sign as
66.I x
67and a magnitude less than the magnitude of
68.IR y .
847e0d88 69.PP
1cc72c09
MK
70If
71.I x
72or
73.I y
74is a NaN, a NaN is returned.
847e0d88 75.PP
1cc72c09
MK
76If
77.I x
385cf745 78is an infinity,
efe294cb 79a domain error occurs, and
1cc72c09 80a NaN is returned.
847e0d88 81.PP
1cc72c09
MK
82If
83.I y
84is zero,
efe294cb 85a domain error occurs, and
1cc72c09 86a NaN is returned.
847e0d88 87.PP
1cc72c09
MK
88If
89.I x
90is +0 (\-0), and
91.I y
92is not zero, +0 (\-0) is returned.
fea681da 93.SH ERRORS
1cc72c09
MK
94See
95.BR math_error (7)
96for information on how to determine whether an error has occurred
97when calling these functions.
98.PP
99The following errors can occur:
100.TP
101Domain error: \fIx\fP is an infinity
9343357b
MK
102.I errno
103is set to
1ae6b2c7 104.B EDOM
9343357b 105(but see BUGS).
1cc72c09
MK
106An invalid floating-point exception
107.RB ( FE_INVALID )
108is raised.
fea681da 109.TP
1cc72c09
MK
110Domain error: \fIy\fP is zero
111.I errno
112is set to
113.BR EDOM .
114An invalid floating-point exception
115.RB ( FE_INVALID )
116is raised.
117.\" POSIX.1 documents an optional underflow error, but AFAICT it doesn't
118.\" (can't?) occur -- mtk, Jul 2008
86576222
MS
119.SH ATTRIBUTES
120For an explanation of the terms used in this section, see
121.BR attributes (7).
c466875e
MK
122.ad l
123.nh
86576222
MS
124.TS
125allbox;
c466875e 126lbx lb lb
86576222
MS
127l l l.
128Interface Attribute Value
129T{
130.BR fmod (),
131.BR fmodf (),
132.BR fmodl ()
133T} Thread safety MT-Safe
134.TE
c466875e
MK
135.hy
136.ad
137.sp 1
3113c7f3 138.SH STANDARDS
9a74e018 139C99, POSIX.1-2001, POSIX.1-2008.
847e0d88 140.PP
22cb459d
MK
141The variant returning
142.I double
143also conforms to
144SVr4, 4.3BSD, C89.
9343357b
MK
145.SH BUGS
146Before version 2.10, the glibc implementation did not set
147.\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=6784
148.I errno
149to
150.B EDOM
151when a domain error occurred for an infinite
152.IR x .
47297adb 153.SH SEE ALSO
fea681da 154.BR remainder (3)