OSDN Git Service

9e4cfd5de9f65324530a623ad05cb942a0cec090
[linuxjm/LDP_man-pages.git] / original / 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 2013-07-15 "" "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 _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
33 _POSIX_C_SOURCE\ >=\ 200112L;
34 .br
35 or
36 .I cc\ -std=c99
37 .RE
38 .ad
39 .SH DESCRIPTION
40 These functions return the positive difference, max(\fIx\fP-\fIy\fP,0),
41 between their arguments.
42 .SH RETURN VALUE
43 On success, these functions return the positive difference.
44
45 If
46 .I x
47 or
48 .I y
49 is a NaN, a NaN is returned.
50
51 If the result overflows,
52 a range error occurs,
53 and the functions return
54 .BR HUGE_VAL ,
55 .BR HUGE_VALF ,
56 or
57 .BR HUGE_VALL ,
58 respectively.
59 .SH ERRORS
60 See
61 .BR math_error (7)
62 for information on how to determine whether an error has occurred
63 when calling these functions.
64 .PP
65 The following errors can occur:
66 .TP
67 Range error: result overflow
68 .\" .I errno
69 .\" is set to
70 .\" .BR ERANGE .
71 An overflow floating-point exception
72 .RB ( FE_OVERFLOW )
73 is raised.
74 .PP
75 These 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
79 .SH VERSIONS
80 These functions first appeared in glibc in version 2.1.
81 .SH ATTRIBUTES
82 .SS Multithreading (see pthreads(7))
83 The
84 .BR fdim (),
85 .BR fdimf (),
86 and
87 .BR fdiml ()
88 functions are thread-safe.
89 .SH CONFORMING TO
90 C99, POSIX.1-2001.
91 .SH SEE ALSO
92 .BR fmax (3)
93 .SH COLOPHON
94 This page is part of release 3.67 of the Linux
95 .I man-pages
96 project.
97 A description of the project,
98 information about reporting bugs,
99 and the latest version of this page,
100 can be found at
101 \%http://www.kernel.org/doc/man\-pages/.