1FDIM(3) Linux Programmer's Manual FDIM(3)
2
3
4
6 fdim, fdimf, fdiml - positive difference
7
9 #include <math.h>
10
11 double fdim(double x, double y);
12 float fdimf(float x, float y);
13 long double fdiml(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 fdimf(), fdiml():
20 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
21
23 These functions return the positive difference, max(x-y,0), between
24 their arguments.
25
27 On success, these functions return the positive difference.
28
29 If x or y is a NaN, a NaN is returned.
30
31 If the result overflows, a range error occurs, and the functions return
32 HUGE_VAL, HUGE_VALF, or HUGE_VALL, respectively.
33
35 See math_error(7) for information on how to determine whether an error
36 has occurred when calling these functions.
37
38 The following errors can occur:
39
40 Range error: result overflow
41 errno is set to ERANGE. An overflow floating-point exception
42 (FE_OVERFLOW) is raised.
43
45 These functions first appeared in glibc in version 2.1.
46
48 For an explanation of the terms used in this section, see at‐
49 tributes(7).
50
51 ┌─────────────────────────┬───────────────┬─────────┐
52 │Interface │ Attribute │ Value │
53 ├─────────────────────────┼───────────────┼─────────┤
54 │fdim(), fdimf(), fdiml() │ Thread safety │ MT-Safe │
55 └─────────────────────────┴───────────────┴─────────┘
57 C99, POSIX.1-2001, POSIX.1-2008.
58
60 Before glibc version 2.24 on certain architectures (e.g., x86, but not
61 x86_64) these functions did not set errno.
62
64 fmax(3)
65
67 This page is part of release 5.10 of the Linux man-pages project. A
68 description of the project, information about reporting bugs, and the
69 latest version of this page, can be found at
70 https://www.kernel.org/doc/man-pages/.
71
72
73
74 2020-06-09 FDIM(3)