]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/fdim.3
d7abb2ad75b5726c23b4f7e6b56ba3333e6b708e
[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 .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
6 .\" Distributed under GPL
7 .\" %%%LICENSE_END
8 .\"
9 .TH FDIM 3 2015-04-19 "" "Linux Programmer's Manual"
10 .SH NAME
11 fdim, fdimf, fdiml \- positive difference
12 .SH SYNOPSIS
13 .B #include <math.h>
14 .sp
15 .BI "double fdim(double " x ", double " y );
16 .br
17 .BI "float fdimf(float " x ", float " y );
18 .br
19 .BI "long double fdiml(long double " x ", long double " y );
20 .sp
21 Link with \fI\-lm\fP.
22 .sp
23 .in -4n
24 Feature 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 ():
31 .RS 4
32 _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
33 .br
34 or
35 .I cc\ -std=c99
36 .RE
37 .ad
38 .SH DESCRIPTION
39 These functions return the positive difference, max(\fIx\fP-\fIy\fP,0),
40 between their arguments.
41 .SH RETURN VALUE
42 On success, these functions return the positive difference.
43
44 If
45 .I x
46 or
47 .I y
48 is a NaN, a NaN is returned.
49
50 If the result overflows,
51 a range error occurs,
52 and the functions return
53 .BR HUGE_VAL ,
54 .BR HUGE_VALF ,
55 or
56 .BR HUGE_VALL ,
57 respectively.
58 .SH ERRORS
59 See
60 .BR math_error (7)
61 for information on how to determine whether an error has occurred
62 when calling these functions.
63 .PP
64 The following errors can occur:
65 .TP
66 Range error: result overflow
67 .\" .I errno
68 .\" is set to
69 .\" .BR ERANGE .
70 An overflow floating-point exception
71 .RB ( FE_OVERFLOW )
72 is raised.
73 .PP
74 These functions do not set
75 .IR errno .
76 .\" FIXME . Is it intentional that these functions do not set errno?
77 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6796
78 .SH VERSIONS
79 These functions first appeared in glibc in version 2.1.
80 .SH ATTRIBUTES
81 For an explanation of the terms used in this section, see
82 .BR attributes (7).
83 .TS
84 allbox;
85 lbw24 lb lb
86 l l l.
87 Interface Attribute Value
88 T{
89 .BR fdim (),
90 .BR fdimf (),
91 .BR fdiml ()
92 T} Thread safety MT-Safe
93 .TE
94 .SH CONFORMING TO
95 C99, POSIX.1-2001, POSIX.1-2008.
96 .SH SEE ALSO
97 .BR fmax (3)