1fmod(3M) Mathematical Library Functions fmod(3M)
2
3
4
6 fmod, fmodf, fmodl - floating-point remainder value function
7
9 c99 [ flag... ] file... -lm [ library... ]
10 #include <math.h>
11
12 double fmod(double x, double y);
13
14
15 float fmodf(float x, float y);
16
17
18 long double fmodl(long double x, long double y);
19
20
22 These functions return the floating-point remainder of the division of
23 x by y.
24
26 These functions return the value x − i * y, for some integer i such
27 that, if y is non-zero, the result has the same sign as x and magnitude
28 less than the magnitude of y.
29
30
31 If x or y is NaN, a NaN is returned.
32
33
34 If y is 0, a domain error occurs and a NaN is returned.
35
36
37 If x is infinite, a domain error occurs and a NaN is returned.
38
39
40 If x is ±0 and y is not 0, ±0 is returned.
41
42
43 If x is not infinite and y is ±Inf, x is returned.
44
46 These functions will fail if:
47
48 Domain Error The x argument is infinite or y is 0.
49
50 If the integer expression (math_errhandling &
51 MATH_ERREXCEPT) is non-zero, the invalid floating-point
52 exception is raised.
53
54
56 An application wanting to check for exceptions should call feclearex‐
57 cept(FE_ALL_EXCEPT) before calling these functions. On return, if
58 fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is
59 non-zero, an exception has been raised. An application should either
60 examine the return value or check the floating point exception flags to
61 detect exceptions.
62
64 See attributes(5) for descriptions of the following attributes:
65
66
67
68
69 ┌─────────────────────────────┬─────────────────────────────┐
70 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
71 ├─────────────────────────────┼─────────────────────────────┤
72 │Interface Stability │Standard │
73 ├─────────────────────────────┼─────────────────────────────┤
74 │MT-Level │MT-Safe │
75 └─────────────────────────────┴─────────────────────────────┘
76
78 feclearexcept(3M), fetestexcept(3M), isnan(3M), math.h(3HEAD),
79 attributes(5), standards(5)
80
81
82
83SunOS 5.11 12 Jul 2006 fmod(3M)