1REMQUO(3P)                 POSIX Programmer's Manual                REMQUO(3P)
2
3
4

PROLOG

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

NAME

12       remquo, remquof, remquol — remainder functions
13

SYNOPSIS

15       #include <math.h>
16
17       double remquo(double x, double y, int *quo);
18       float remquof(float x, float y, int *quo);
19       long double remquol(long double x, long double y, int *quo);
20

DESCRIPTION

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       The remquo(), remquof(), and remquol() functions shall compute the same
28       remainder as the remainder(), remainderf(), and remainderl() functions,
29       respectively. In the object pointed to by quo, they store a value whose
30       sign is the sign of x/y and whose magnitude is congruent modulo  2n  to
31       the  magnitude of the integral quotient of x/y, where n is an implemen‐
32       tation-defined integer greater than or equal to 3. If y  is  zero,  the
33       value stored in the object pointed to by quo is unspecified.
34
35       An  application  wishing to check for error situations should set errno
36       to zero and  call  feclearexcept(FE_ALL_EXCEPT)  before  calling  these
37       functions. On return, if errno is non-zero or fetestexcept(FE_INVALID |
38       FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero,  an  error  has
39       occurred.
40

RETURN VALUE

42       These functions shall return x REM y.
43
44       On  systems that do not support the IEC 60559 Floating-Point option, if
45       y is zero, it is implementation-defined whether a domain  error  occurs
46       or zero is returned.
47
48       If x or y is NaN, a NaN shall be returned.
49
50       If  x  is ±Inf or y is zero and the other argument is non-NaN, a domain
51       error shall occur, and a NaN shall be returned.
52

ERRORS

54       These functions shall fail if:
55
56       Domain Error
57                   The x argument is ±Inf, or the y argument  is  ±0  and  the
58                   other argument is non-NaN.
59
60                   If  the  integer expression (math_errhandling & MATH_ERRNO)
61                   is non-zero, then errno shall be set  to  [EDOM].   If  the
62                   integer  expression  (math_errhandling & MATH_ERREXCEPT) is
63                   non-zero, then the invalid floating-point  exception  shall
64                   be raised.
65
66       These functions may fail if:
67
68       Domain Error
69                   The y argument is zero.
70
71                   If  the  integer expression (math_errhandling & MATH_ERRNO)
72                   is non-zero, then errno shall be set  to  [EDOM].   If  the
73                   integer  expression  (math_errhandling & MATH_ERREXCEPT) is
74                   non-zero, then the invalid floating-point  exception  shall
75                   be raised.
76
77       The following sections are informative.
78

EXAMPLES

80       None.
81

APPLICATION USAGE

83       On   error,   the   expressions  (math_errhandling  &  MATH_ERRNO)  and
84       (math_errhandling & MATH_ERREXCEPT) are independent of each other,  but
85       at least one of them must be non-zero.
86

RATIONALE

88       These functions are intended for implementing argument reductions which
89       can exploit a few low-order bits of the quotient. Note that x may be so
90       large  in  magnitude  relative to y that an exact representation of the
91       quotient is not practical.
92

FUTURE DIRECTIONS

94       None.
95

SEE ALSO

97       feclearexcept(), fetestexcept(), remainder()
98
99       The Base Definitions volume of POSIX.1‐2017, Section 4.20, Treatment of
100       Error Conditions for Mathematical Functions, <math.h>
101
103       Portions  of  this text are reprinted and reproduced in electronic form
104       from IEEE Std 1003.1-2017, Standard for Information Technology --  Por‐
105       table  Operating System Interface (POSIX), The Open Group Base Specifi‐
106       cations Issue 7, 2018 Edition, Copyright (C) 2018 by the  Institute  of
107       Electrical  and  Electronics Engineers, Inc and The Open Group.  In the
108       event of any discrepancy between this version and the original IEEE and
109       The  Open Group Standard, the original IEEE and The Open Group Standard
110       is the referee document. The original Standard can be  obtained  online
111       at http://www.opengroup.org/unix/online.html .
112
113       Any  typographical  or  formatting  errors that appear in this page are
114       most likely to have been introduced during the conversion of the source
115       files  to  man page format. To report such errors, see https://www.ker
116       nel.org/doc/man-pages/reporting_bugs.html .
117
118
119
120IEEE/The Open Group                  2017                           REMQUO(3P)
Impressum