1FMOD(3)                    Linux Programmer's Manual                   FMOD(3)
2
3
4

NAME

6       fmod, fmodf, fmodl - floating-point remainder function
7

SYNOPSIS

9       #include <math.h>
10
11       double fmod(double x, double y);
12       float fmodf(float x, float y);
13       long double fmodl(long double x, long double y);
14
15       Link with -lm.
16
17   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
18
19       fmodf(), fmodl(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600
20       || _ISOC99_SOURCE; or cc -std=c99
21

DESCRIPTION

23       The fmod() function computes the floating-point remainder of dividing x
24       by y.  The return value is x - n * y, where n is the quotient of x / y,
25       rounded towards zero to an integer.
26

RETURN VALUE

28       On success, these functions return the value x - n*y, for some  integer
29       n,  such that the returned value has the same sign as x and a magnitude
30       less than the magnitude of y.
31
32       If x or y is a NaN, a NaN is returned.
33
34       If x is an infinity, a domain error occurs, and a NaN is returned.
35
36       If y is zero, a domain error occurs, and a NaN is returned.
37
38       If x is +0 (-0), and y is not zero, +0 (-0) is returned.
39

ERRORS

41       See math_error(7) for information on how to determine whether an  error
42       has occurred when calling these functions.
43
44       The following errors can occur:
45
46       Domain error: x is an infinity
47              An invalid floating-point exception (FE_INVALID) is raised.
48
49              These functions do not set errno for this case.
50
51       Domain error: y is zero
52              errno  is  set  to  EDOM.   An  invalid floating-point exception
53              (FE_INVALID) is raised.
54

CONFORMING TO

56       C99, POSIX.1-2001.  The variant returning double also conforms to SVr4,
57       4.3BSD, C89.
58

SEE ALSO

60       remainder(3)
61

COLOPHON

63       This  page  is  part of release 3.22 of the Linux man-pages project.  A
64       description of the project, and information about reporting  bugs,  can
65       be found at http://www.kernel.org/doc/man-pages/.
66
67
68
69                                  2008-08-05                           FMOD(3)
Impressum