1FMOD(3) Linux Programmer's Manual FMOD(3)
2
3
4
6 fmod, fmodf, fmodl - floating-point remainder function
7
9 #include <math.h>
10
11 double fmod(double x, double y);
12 float fmodf(float x, float y);
13 long double fmodl(long double x, long double y);
14
15 Link with -lm.
16
17 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
18
19 fmodf(), fmodl():
20 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600 ||
21 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L;
22 or cc -std=c99
23
25 The fmod() function computes the floating-point remainder of dividing x
26 by y. The return value is x - n * y, where n is the quotient of x / y,
27 rounded toward zero to an integer.
28
30 On success, these functions return the value x - n*y, for some integer
31 n, such that the returned value has the same sign as x and a magnitude
32 less than the magnitude of y.
33
34 If x or y is a NaN, a NaN is returned.
35
36 If x is an infinity, a domain error occurs, and a NaN is returned.
37
38 If y is zero, a domain error occurs, and a NaN is returned.
39
40 If x is +0 (-0), and y is not zero, +0 (-0) is returned.
41
43 See math_error(7) for information on how to determine whether an error
44 has occurred when calling these functions.
45
46 The following errors can occur:
47
48 Domain error: x is an infinity
49 errno is set to EDOM (but see BUGS). An invalid floating-point
50 exception (FE_INVALID) is raised.
51
52 Domain error: y is zero
53 errno is set to EDOM. An invalid floating-point exception
54 (FE_INVALID) is raised.
55
57 C99, POSIX.1-2001. The variant returning double also conforms to SVr4,
58 4.3BSD, C89.
59
61 Before version 2.10, the glibc implementation did not set errno to EDOM
62 when a domain error occurred for an infinite x.
63
65 remainder(3)
66
68 This page is part of release 3.53 of the Linux man-pages project. A
69 description of the project, and information about reporting bugs, can
70 be found at http://www.kernel.org/doc/man-pages/.
71
72
73
74 2012-03-15 FMOD(3)