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