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():
20           _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
21               || /* Since glibc 2.19: */ _DEFAULT_SOURCE
22               || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
23

DESCRIPTION

25       These  functions  compute the floating-point remainder of dividing x by
26       y.  The return value is x - n * y, where n is the quotient of  x  /  y,
27       rounded toward zero to an integer.
28

RETURN VALUE

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

ERRORS

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

ATTRIBUTES

57       For an  explanation  of  the  terms  used  in  this  section,  see  at‐
58       tributes(7).
59
60       ┌────────────────────────────────────────────┬───────────────┬─────────┐
61Interface                                   Attribute     Value   
62       ├────────────────────────────────────────────┼───────────────┼─────────┤
63fmod(), fmodf(), fmodl()                    │ Thread safety │ MT-Safe │
64       └────────────────────────────────────────────┴───────────────┴─────────┘
65

CONFORMING TO

67       C99, POSIX.1-2001, POSIX.1-2008.
68
69       The variant returning double also conforms to SVr4, 4.3BSD, C89.
70

BUGS

72       Before version 2.10, the glibc implementation did not set errno to EDOM
73       when a domain error occurred for an infinite x.
74

SEE ALSO

76       remainder(3)
77

COLOPHON

79       This page is part of release 5.13 of the Linux  man-pages  project.   A
80       description  of  the project, information about reporting bugs, and the
81       latest    version    of    this    page,    can     be     found     at
82       https://www.kernel.org/doc/man-pages/.
83
84
85
86                                  2021-03-22                           FMOD(3)
Impressum