1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
3 .\" <mtk.manpages@gmail.com>
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
7 .\" References consulted:
8 .\" Linux libc source code
9 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
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)
15 .TH FMOD 3 2021-03-22 "Linux man-pages (unreleased)"
17 fmod, fmodf, fmodl \- floating-point remainder function
20 .RI ( libm ", " \-lm )
25 .BI "double fmod(double " x ", double " y );
26 .BI "float fmodf(float " x ", float " y );
27 .BI "long double fmodl(long double " x ", long double " y );
31 Feature Test Macro Requirements for glibc (see
32 .BR feature_test_macros (7)):
38 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
39 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
40 || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
43 These functions compute the floating-point remainder of dividing
59 rounded toward zero to an integer.
62 functions return the value \fIx\fP\ \-\ \fIn\fP*\fIy\fP,
65 such that the returned value has the same sign as
67 and a magnitude less than the magnitude of
74 is a NaN, a NaN is returned.
79 a domain error occurs, and
85 a domain error occurs, and
92 is not zero, +0 (\-0) is returned.
96 for information on how to determine whether an error has occurred
97 when calling these functions.
99 The following errors can occur:
101 Domain error: \fIx\fP is an infinity
106 An invalid floating-point exception
110 Domain error: \fIy\fP is zero
114 An invalid floating-point exception
117 .\" POSIX.1 documents an optional underflow error, but AFAICT it doesn't
118 .\" (can't?) occur -- mtk, Jul 2008
120 For an explanation of the terms used in this section, see
128 Interface Attribute Value
133 T} Thread safety MT-Safe
139 C99, POSIX.1-2001, POSIX.1-2008.
141 The variant returning
146 Before version 2.10, the glibc implementation did not set
147 .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=6784
151 when a domain error occurred for an infinite