1REMAINDER(3P)              POSIX Programmer's Manual             REMAINDER(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
11

NAME

13       remainder, remainderf, remainderl — remainder function
14

SYNOPSIS

16       #include <math.h>
17
18       double remainder(double x, double y);
19       float remainderf(float x, float y);
20       long double remainderl(long double x, long double y);
21

DESCRIPTION

23       The functionality described on this reference page is aligned with  the
24       ISO C  standard.  Any  conflict between the requirements described here
25       and the ISO C standard is unintentional. This  volume  of  POSIX.1‐2008
26       defers to the ISO C standard.
27
28       These functions shall return the floating-point remainder r=xny when y
29       is non-zero. The value n is the integral value nearest the exact  value
30       x/y.  When |nx/y|=½, the value n is chosen to be even.
31
32       The behavior of remainder() shall be independent of the rounding mode.
33

RETURN VALUE

35       Upon  successful completion, these functions shall return the floating-
36       point remainder r=xny when y is non-zero.
37
38       On systems that do not support the IEC 60559 Floating-Point option,  if
39       y  is  zero, it is implementation-defined whether a domain error occurs
40       or zero is returned.
41
42       If x or y is NaN, a NaN shall be returned.
43
44       If x is infinite or y is 0 and the other is  non-NaN,  a  domain  error
45       shall occur, and a NaN shall be returned.
46

ERRORS

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

EXAMPLES

74       None.
75

APPLICATION USAGE

77       On  error,  the  expressions  (math_errhandling   &   MATH_ERRNO)   and
78       (math_errhandling  & MATH_ERREXCEPT) are independent of each other, but
79       at least one of them must be non-zero.
80

RATIONALE

82       None.
83

FUTURE DIRECTIONS

85       None.
86

SEE ALSO

88       abs(), div(), feclearexcept(), fetestexcept(), ldiv()
89
90       The Base Definitions volume of POSIX.1‐2008, Section 4.19, Treatment of
91       Error Conditions for Mathematical Functions, <math.h>
92
94       Portions  of  this text are reprinted and reproduced in electronic form
95       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
96       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
97       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
98       cal  and  Electronics  Engineers,  Inc  and  The  Open Group.  (This is
99       POSIX.1-2008 with the 2013 Technical Corrigendum  1  applied.)  In  the
100       event of any discrepancy between this version and the original IEEE and
101       The Open Group Standard, the original IEEE and The Open Group  Standard
102       is  the  referee document. The original Standard can be obtained online
103       at http://www.unix.org/online.html .
104
105       Any typographical or formatting errors that appear  in  this  page  are
106       most likely to have been introduced during the conversion of the source
107       files to man page format. To report such errors,  see  https://www.ker
108       nel.org/doc/man-pages/reporting_bugs.html .
109
110
111
112IEEE/The Open Group                  2013                        REMAINDER(3P)
Impressum