1REMAINDER(3) Linux Programmer's Manual REMAINDER(3)
2
3
4
6 drem, dremf, dreml, remainder, remainderf, remainderl - floating-point
7 remainder function
8
10 #include <math.h>
11
12 /* The C99 versions */
13 double remainder(double x, double y);
14 float remainderf(float x, float y);
15 long double remainderl(long double x, long double y);
16
17 /* Obsolete synonyms */
18 double drem(double x, double y);
19 float dremf(float x, float y);
20 long double dreml(long double x, long double y);
21
22 Link with -lm.
23
25 The remainder() function computes the remainder of dividing x by y.
26 The return value is x - n * y, where n is the value x / y, rounded to
27 the nearest integer. If this quotient is 1/2 (mod 1), it is rounded to
28 the nearest even number (independent of the current rounding mode). If
29 the return value is 0, it has the sign of x.
30
31 The drem() function does precisely the same thing.
32
34 The remainder() function returns the remainder, unless y is zero, when
35 the function fails and errno is set.
36
38 EDOM The denominator y is zero.
39
41 IEC 60559. The functions remainder(), remainderf(), and remainderl()
42 are from C99. The function drem() is from 4.3BSD. The float and long
43 double variants dremf() and dreml() exist on some systems, such as
44 Tru64 and glibc2.
45
47 The call "remainder(29.0, 3.0)" returns -1.
48
50 fmod(3), remquo(3)
51
52
53
54 2003-11-18 REMAINDER(3)