1REMAINDER(P) POSIX Programmer's Manual REMAINDER(P)
2
3
4
6 remainder, remainderf, remainderl - remainder function
7
9 #include <math.h>
10
11 double remainder(double x, double y);
12 float remainderf(float x, float y);
13 long double remainderl(long double x, long double y);
14
15
17 These functions shall return the floating-point remainder r= x- ny when
18 y is non-zero. The value n is the integral value nearest the exact
19 value x/ y. When |n-x/y|=0.5, the value n is chosen to be even.
20
21 The behavior of remainder() shall be independent of the rounding mode.
22
24 Upon successful completion, these functions shall return the floating-
25 point remainder r= x- ny when y is non-zero.
26
27 If x or y is NaN, a NaN shall be returned.
28
29 If x is infinite or y is 0 and the other is non-NaN, a domain error
30 shall occur, and either a NaN (if supported), or an implementation-
31 defined value shall be returned.
32
34 These functions shall fail if:
35
36 Domain Error
37 The x argument is ±Inf, or the y argument is ±0 and the other
38 argument is non-NaN.
39
40 If the integer expression (math_errhandling & MATH_ERRNO) is non-zero,
41 then errno shall be set to [EDOM]. If the integer expression
42 (math_errhandling & MATH_ERREXCEPT) is non-zero, then the invalid
43 floating-point exception shall be raised.
44
45
46 The following sections are informative.
47
49 None.
50
52 On error, the expressions (math_errhandling & MATH_ERRNO) and
53 (math_errhandling & MATH_ERREXCEPT) are independent of each other, but
54 at least one of them must be non-zero.
55
57 None.
58
60 None.
61
63 abs() , div() , feclearexcept() , fetestexcept() , ldiv() , the Base
64 Definitions volume of IEEE Std 1003.1-2001, Section 4.18, Treatment of
65 Error Conditions for Mathematical Functions, <math.h>
66
68 Portions of this text are reprinted and reproduced in electronic form
69 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
70 -- Portable Operating System Interface (POSIX), The Open Group Base
71 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
72 Electrical and Electronics Engineers, Inc and The Open Group. In the
73 event of any discrepancy between this version and the original IEEE and
74 The Open Group Standard, the original IEEE and The Open Group Standard
75 is the referee document. The original Standard can be obtained online
76 at http://www.opengroup.org/unix/online.html .
77
78
79
80IEEE/The Open Group 2003 REMAINDER(P)