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
21
23 These functions shall return the floating-point remainder r= x- ny when
24 y is non-zero. The value n is the integral value nearest the exact
25 value x/ y. When |n-x/y|=0.5, the value n is chosen to be even.
26
27 The behavior of remainder() shall be independent of the rounding mode.
28
30 Upon successful completion, these functions shall return the floating-
31 point remainder r= x- ny when y is non-zero.
32
33 If x or y is NaN, a NaN shall be returned.
34
35 If x is infinite or y is 0 and the other is non-NaN, a domain error
36 shall occur, and either a NaN (if supported), or an implementation-
37 defined value shall be returned.
38
40 These functions shall fail if:
41
42 Domain Error
43 The x argument is ±Inf, or the y argument is ±0 and the other
44 argument is non-NaN.
45
46 If the integer expression (math_errhandling & MATH_ERRNO) is non-zero,
47 then errno shall be set to [EDOM]. If the integer expression
48 (math_errhandling & MATH_ERREXCEPT) is non-zero, then the invalid
49 floating-point exception shall be raised.
50
51
52 The following sections are informative.
53
55 None.
56
58 On error, the expressions (math_errhandling & MATH_ERRNO) and
59 (math_errhandling & MATH_ERREXCEPT) are independent of each other, but
60 at least one of them must be non-zero.
61
63 None.
64
66 None.
67
69 abs(), div(), feclearexcept(), fetestexcept(), ldiv(), the Base Defini‐
70 tions volume of IEEE Std 1003.1-2001, Section 4.18, Treatment of Error
71 Conditions for Mathematical Functions, <math.h>
72
74 Portions of this text are reprinted and reproduced in electronic form
75 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
76 -- Portable Operating System Interface (POSIX), The Open Group Base
77 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
78 Electrical and Electronics Engineers, Inc and The Open Group. In the
79 event of any discrepancy between this version and the original IEEE and
80 The Open Group Standard, the original IEEE and The Open Group Standard
81 is the referee document. The original Standard can be obtained online
82 at http://www.opengroup.org/unix/online.html .
83
84
85
86IEEE/The Open Group 2003 REMAINDER(3P)