Debian Codegraph @

upstream/debian-trixie/man3/fdim.3

raw
1 '\" t
2 .\" Copyright 2003 Walter Harms, Andries Brouwer
3 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
4 .\" <[email protected]>
5 .\"
6 .\" SPDX-License-Identifier: GPL-1.0-or-later
7 .\"
8 .TH fdim 3 2024-05-02 "Linux man-pages 6.9.1"
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 .P
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 .P
23 .RS -4
24 Feature Test Macro Requirements for glibc (see
25 .BR feature_test_macros (7)):
26 .RE
27 .P
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 .P
39 If
40 .I x
41 or
42 .I y
43 is a NaN, a NaN is returned.
44 .P
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 .P
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 .TS
72 allbox;
73 lbx lb lb
74 l l l.
75 Interface Attribute Value
76 T{
77 .na
78 .nh
79 .BR fdim (),
80 .BR fdimf (),
81 .BR fdiml ()
82 T} Thread safety MT-Safe
83 .TE
84 .SH STANDARDS
85 C11, POSIX.1-2008.
86 .SH HISTORY
87 glibc 2.1.
88 C99, POSIX.1-2001.
89 .SH BUGS
90 Before glibc 2.24
91 .\" https://www.sourceware.org/bugzilla/show_bug.cgi?id=6796
92 on certain architectures (e.g., x86, but not x86_64)
93 these functions did not set
94 .IR errno .
95 .SH SEE ALSO
96 .BR fmax (3)