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