]>
Commit | Line | Data |
---|---|---|
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 |
11 | fdim, 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 |
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 (): | |
f1f0e4ed | 31 | .RS 4 |
a5ea8d23 MK |
32 | _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE || |
33 | _POSIX_C_SOURCE\ >=\ 200112L; | |
f1f0e4ed MK |
34 | .br |
35 | or | |
a637b728 | 36 | .I cc\ -std=c99 |
f1f0e4ed MK |
37 | .RE |
38 | .ad | |
fea681da | 39 | .SH DESCRIPTION |
a637b728 MK |
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 | ||
fea681da MK |
45 | If |
46 | .I x | |
47 | or | |
48 | .I y | |
a637b728 MK |
49 | is a NaN, a NaN is returned. |
50 | ||
51 | If the result overflows, | |
efe294cb | 52 | a range error occurs, |
a637b728 MK |
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 | |
f0d7ce1d MK |
79 | .SH VERSIONS |
80 | These functions first appeared in glibc in version 2.1. | |
47297adb | 81 | .SH CONFORMING TO |
a637b728 | 82 | C99, POSIX.1-2001. |
47297adb | 83 | .SH SEE ALSO |
fea681da | 84 | .BR fmax (3) |