1REMQUO(P) POSIX Programmer's Manual REMQUO(P)
2
3
4
6 remquo, remquof, remquol - remainder functions
7
9 #include <math.h>
10
11 double remquo(double x, double y, int *quo);
12 float remquof(float x, float y, int *quo);
13 long double remquol(long double x, long double y, int *quo);
14
15
17 The remquo(), remquof(), and remquol() functions shall compute the same
18 remainder as the remainder(), remainderf(), and remainderl() functions,
19 respectively. In the object pointed to by quo, they store a value whose
20 sign is the sign of x/ y and whose magnitude is congruent modulo 2**n
21 to the magnitude of the integral quotient of x/ y, where n is an imple‐
22 mentation-defined integer greater than or equal to 3.
23
24 An application wishing to check for error situations should set errno
25 to zero and call feclearexcept(FE_ALL_EXCEPT) before calling these
26 functions. On return, if errno is non-zero or fetestexcept(FE_INVALID
27 | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error has
28 occurred.
29
31 These functions shall return x REM y.
32
33 If x or y is NaN, a NaN shall be returned.
34
35 If x is ±Inf or y is zero and the other argument is non-NaN, a domain
36 error shall occur, and either a NaN (if supported), or an implementa‐
37 tion-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 These functions are intended for implementing argument reductions which
64 can exploit a few low-order bits of the quotient. Note that x may be so
65 large in magnitude relative to y that an exact representation of the
66 quotient is not practical.
67
69 None.
70
72 feclearexcept() , fetestexcept() , remainder() , the Base Definitions
73 volume of IEEE Std 1003.1-2001, Section 4.18, Treatment of Error Condi‐
74 tions for Mathematical Functions, <math.h>
75
77 Portions of this text are reprinted and reproduced in electronic form
78 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
79 -- Portable Operating System Interface (POSIX), The Open Group Base
80 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
81 Electrical and Electronics Engineers, Inc and The Open Group. In the
82 event of any discrepancy between this version and the original IEEE and
83 The Open Group Standard, the original IEEE and The Open Group Standard
84 is the referee document. The original Standard can be obtained online
85 at http://www.opengroup.org/unix/online.html .
86
87
88
89IEEE/The Open Group 2003 REMQUO(P)