]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/fdim.3
d503eca66d620a8f6cf9ee1208e6202aad4df65a
[thirdparty/man-pages.git] / man3 / fdim.3
1 '\" t
2 .\" Copyright 2003 Walter Harms, Andries Brouwer
3 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
4 .\" <mtk.manpages@gmail.com>
5 .\"
6 .\" SPDX-License-Identifier: GPL-1.0-or-later
7 .\"
8 .TH fdim 3 (date) "Linux man-pages (unreleased)"
9 .SH NAME
10 fdim, fdimf, fdiml \- positive difference
11 .SH LIBRARY
12 Math library
13 .RI ( libm ", " \-lm )
14 .SH SYNOPSIS
15 .nf
16 .B #include <math.h>
17 .PP
18 .BI "double fdim(double " x ", double " y );
19 .BI "float fdimf(float " x ", float " y );
20 .BI "long double fdiml(long double " x ", long double " y );
21 .fi
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
39 If
40 .I x
41 or
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 ,
50 or
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 ATTRIBUTES
69 For an explanation of the terms used in this section, see
70 .BR attributes (7).
71 .ad l
72 .nh
73 .TS
74 allbox;
75 lbx lb lb
76 l l l.
77 Interface Attribute Value
78 T{
79 .BR fdim (),
80 .BR fdimf (),
81 .BR fdiml ()
82 T} Thread safety MT-Safe
83 .TE
84 .hy
85 .ad
86 .sp 1
87 .SH STANDARDS
88 C11, POSIX.1-2008.
89 .SH HISTORY
90 glibc 2.1.
91 C99, POSIX.1-2001.
92 .SH BUGS
93 Before glibc 2.24
94 .\" https://www.sourceware.org/bugzilla/show_bug.cgi?id=6796
95 on certain architectures (e.g., x86, but not x86_64)
96 these functions did not set
97 .IR errno .
98 .SH SEE ALSO
99 .BR fmax (3)