futex.2: Rework the description of FUTEX_LOCK_PI2
[man-pages.git] / man3 / fdim.3
blob3096f4bbb5f16d99c014023e5e490d08cf0d4b61
1 .\" Copyright 2003 Walter Harms, Andries Brouwer
2 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
3 .\"     <mtk.manpages@gmail.com>
4 .\"
5 .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
6 .\" Distributed under GPL
7 .\" %%%LICENSE_END
8 .\"
9 .TH FDIM 3 2021-03-22 "" "Linux Programmer's Manual"
10 .SH NAME
11 fdim, fdimf, fdiml \- positive difference
12 .SH SYNOPSIS
13 .nf
14 .B #include <math.h>
15 .PP
16 .BI "double fdim(double " x ", double " y );
17 .BI "float fdimf(float " x ", float " y );
18 .BI "long double fdiml(long double " x ", long double " y );
19 .fi
20 .PP
21 Link with \fI\-lm\fP.
22 .PP
23 .RS -4
24 Feature Test Macro Requirements for glibc (see
25 .BR feature_test_macros (7)):
26 .RE
27 .PP
28 .BR fdimf (),
29 .BR fdiml ():
30 .nf
31     _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
32 .fi
33 .SH DESCRIPTION
34 These functions return the positive difference, max(\fIx\fP-\fIy\fP,0),
35 between their arguments.
36 .SH RETURN VALUE
37 On success, these functions return the positive difference.
38 .PP
40 .I x
42 .I y
43 is a NaN, a NaN is returned.
44 .PP
45 If the result overflows,
46 a range error occurs,
47 and the functions return
48 .BR HUGE_VAL ,
49 .BR HUGE_VALF ,
51 .BR HUGE_VALL ,
52 respectively.
53 .SH ERRORS
54 See
55 .BR math_error (7)
56 for information on how to determine whether an error has occurred
57 when calling these functions.
58 .PP
59 The following errors can occur:
60 .TP
61 Range error: result overflow
62 .I errno
63 is set to
64 .BR ERANGE .
65 An overflow floating-point exception
66 .RB ( FE_OVERFLOW )
67 is raised.
68 .SH VERSIONS
69 These functions first appeared in glibc in version 2.1.
70 .SH ATTRIBUTES
71 For an explanation of the terms used in this section, see
72 .BR attributes (7).
73 .ad l
74 .nh
75 .TS
76 allbox;
77 lbx lb lb
78 l l l.
79 Interface       Attribute       Value
81 .BR fdim (),
82 .BR fdimf (),
83 .BR fdiml ()
84 T}      Thread safety   MT-Safe
85 .TE
86 .hy
87 .ad
88 .sp 1
89 .SH CONFORMING TO
90 C99, POSIX.1-2001, POSIX.1-2008.
91 .SH BUGS
92 Before glibc version 2.24
93 .\" https://www.sourceware.org/bugzilla/show_bug.cgi?id=6796
94 on certain architectures (e.g., x86, but not x86_64)
95 these functions did not set
96 .IR errno .
97 .SH SEE ALSO
98 .BR fmax (3)