]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/fdim.3
kcmp.2, quotactl.2, subpage_prot.2, get_nprocs_conf.3, if_nameindex.3, if_nametoindex...
[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)
fea681da 6.\" Distributed under GPL.
38f20bb9 7.\" %%%LICENSE_END
fea681da 8.\"
50831f9b 9.TH FDIM 3 2010-09-20 "" "Linux Programmer's Manual"
fea681da
MK
10.SH NAME
11fdim, fdimf, fdiml \- positive difference
12.SH SYNOPSIS
13.B #include <math.h>
14.sp
15.BI "double fdim(double " x ", double " y );
d39541ec 16.br
fea681da 17.BI "float fdimf(float " x ", float " y );
d39541ec 18.br
fea681da
MK
19.BI "long double fdiml(long double " x ", long double " y );
20.sp
a637b728
MK
21Link with \fI\-lm\fP.
22.sp
23.in -4n
24Feature Test Macro Requirements for glibc (see
25.BR feature_test_macros (7)):
26.in
27.sp
28.ad l
29.BR fdimf (),
30.BR fdiml ():
f1f0e4ed 31.RS 4
a5ea8d23
MK
32_XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
33_POSIX_C_SOURCE\ >=\ 200112L;
f1f0e4ed
MK
34.br
35or
a637b728 36.I cc\ -std=c99
f1f0e4ed
MK
37.RE
38.ad
fea681da 39.SH DESCRIPTION
a637b728
MK
40These functions return the positive difference, max(\fIx\fP-\fIy\fP,0),
41between their arguments.
42.SH RETURN VALUE
43On success, these functions return the positive difference.
44
fea681da
MK
45If
46.I x
47or
48.I y
a637b728
MK
49is a NaN, a NaN is returned.
50
51If the result overflows,
efe294cb 52a range error occurs,
a637b728
MK
53and the functions return
54.BR HUGE_VAL ,
55.BR HUGE_VALF ,
56or
57.BR HUGE_VALL ,
58respectively.
59.SH ERRORS
60See
61.BR math_error (7)
62for information on how to determine whether an error has occurred
63when calling these functions.
64.PP
65The following errors can occur:
66.TP
67Range error: result overflow
68.\" .I errno
69.\" is set to
70.\" .BR ERANGE .
71An overflow floating-point exception
72.RB ( FE_OVERFLOW )
73is raised.
74.PP
75These functions do not set
76.IR errno .
77.\" FIXME . Is it intentional that these functions do not set errno?
78.\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6796
f0d7ce1d
MK
79.SH VERSIONS
80These functions first appeared in glibc in version 2.1.
47297adb 81.SH CONFORMING TO
a637b728 82C99, POSIX.1-2001.
47297adb 83.SH SEE ALSO
fea681da 84.BR fmax (3)