1REMAINDER(3P) POSIX Programmer's Manual REMAINDER(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 remainder, remainderf, remainderl — remainder function
13
15 #include <math.h>
16
17 double remainder(double x, double y);
18 float remainderf(float x, float y);
19 long double remainderl(long double x, long double y);
20
22 The functionality described on this reference page is aligned with the
23 ISO C standard. Any conflict between the requirements described here
24 and the ISO C standard is unintentional. This volume of POSIX.1‐2017
25 defers to the ISO C standard.
26
27 These functions shall return the floating-point remainder r=x-ny when y
28 is non-zero. The value n is the integral value nearest the exact value
29 x/y. When |n-x/y|=½, the value n is chosen to be even.
30
31 The behavior of remainder() shall be independent of the rounding mode.
32
34 Upon successful completion, these functions shall return the floating-
35 point remainder r=x-ny when y is non-zero.
36
37 On systems that do not support the IEC 60559 Floating-Point option, if
38 y is zero, it is implementation-defined whether a domain error occurs
39 or zero is returned.
40
41 If x or y is NaN, a NaN shall be returned.
42
43 If x is infinite or y is 0 and the other is non-NaN, a domain error
44 shall occur, and a NaN shall be returned.
45
47 These functions shall fail if:
48
49 Domain Error
50 The x argument is ±Inf, or the y argument is ±0 and the
51 other argument is non-NaN.
52
53 If the integer expression (math_errhandling & MATH_ERRNO)
54 is non-zero, then errno shall be set to [EDOM]. If the
55 integer expression (math_errhandling & MATH_ERREXCEPT) is
56 non-zero, then the invalid floating-point exception shall
57 be raised.
58
59 These functions may fail if:
60
61 Domain Error
62 The y argument is zero.
63
64 If the integer expression (math_errhandling & MATH_ERRNO)
65 is non-zero, then errno shall be set to [EDOM]. If the
66 integer expression (math_errhandling & MATH_ERREXCEPT) is
67 non-zero, then the invalid floating-point exception shall
68 be raised.
69
70 The following sections are informative.
71
73 None.
74
76 On error, the expressions (math_errhandling & MATH_ERRNO) and
77 (math_errhandling & MATH_ERREXCEPT) are independent of each other, but
78 at least one of them must be non-zero.
79
81 None.
82
84 None.
85
87 abs(), div(), feclearexcept(), fetestexcept(), ldiv()
88
89 The Base Definitions volume of POSIX.1‐2017, Section 4.20, Treatment of
90 Error Conditions for Mathematical Functions, <math.h>
91
93 Portions of this text are reprinted and reproduced in electronic form
94 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
95 table Operating System Interface (POSIX), The Open Group Base Specifi‐
96 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
97 Electrical and Electronics Engineers, Inc and The Open Group. In the
98 event of any discrepancy between this version and the original IEEE and
99 The Open Group Standard, the original IEEE and The Open Group Standard
100 is the referee document. The original Standard can be obtained online
101 at http://www.opengroup.org/unix/online.html .
102
103 Any typographical or formatting errors that appear in this page are
104 most likely to have been introduced during the conversion of the source
105 files to man page format. To report such errors, see https://www.ker‐
106 nel.org/doc/man-pages/reporting_bugs.html .
107
108
109
110IEEE/The Open Group 2017 REMAINDER(3P)