Debian Codegraph @

upstream/debian-unstable/man3/fdim.3

raw
1 '\" t
2 .\" Copyright 2003, Walter Harms <[email protected]>
3 .\" Copyright, the authors of the Linux man-pages project
4 .\"
5 .\" SPDX-License-Identifier: GPL-1.0-or-later
6 .\"
7 .TH fdim 3 2026-02-08 "Linux man-pages 6.18"
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 .P
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 .P
22 .RS -4
23 Feature Test Macro Requirements for glibc (see
24 .BR feature_test_macros (7)):
25 .RE
26 .P
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,
34 .IR max(x-y,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)