~ubuntu-branches/ubuntu/precise/manpages-posix/precise

1 by Francesco Paolo Lovergine
rules: linking manpages-posix not manpages.
1
.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved 
2 by Francesco Paolo Lovergine
* Alligned to linux main manpages edition.
2
.TH "FDIM" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
1 by Francesco Paolo Lovergine
rules: linking manpages-posix not manpages.
3
.\" fdim 
4
.SH NAME
5
fdim, fdimf, fdiml \- compute positive difference between two floating-point
6
numbers
7
.SH SYNOPSIS
8
.LP
9
\fB#include <math.h>
10
.br
11
.sp
12
double fdim(double\fP \fIx\fP\fB, double\fP \fIy\fP\fB);
13
.br
14
float fdimf(float\fP \fIx\fP\fB, float\fP \fIy\fP\fB);
15
.br
16
long double fdiml(long double\fP \fIx\fP\fB, long double\fP \fIy\fP\fB);
17
.br
18
\fP
19
.SH DESCRIPTION
20
.LP
21
These functions shall determine the positive difference between their
22
arguments. If \fIx\fP is greater than \fIy\fP, \fIx\fP-
23
\fIy\fP is returned. If \fIx\fP is less than or equal to \fIy\fP,
24
+0 is returned.
25
.LP
26
An application wishing to check for error situations should set \fIerrno\fP
27
to zero and call
28
\fIfeclearexcept\fP(FE_ALL_EXCEPT) before calling these functions.
29
On return, if \fIerrno\fP is non-zero or
30
\fIfetestexcept\fP(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW)
31
is non-zero, an error has occurred.
32
.SH RETURN VALUE
33
.LP
34
Upon successful completion, these functions shall return the positive
35
difference value.
36
.LP
37
If \fIx\fP- \fIy\fP is positive and overflows, a range error shall
38
occur and \fIfdim\fP(), \fIfdimf\fP(), and \fIfdiml\fP()
39
shall return the value of the macro HUGE_VAL, HUGE_VALF, and HUGE_VALL,
40
respectively.
41
.LP
42
If \fIx\fP- \fIy\fP is positive and underflows, a range error may
43
occur, and either ( \fIx\fP- \fIy\fP) (if representable),
44
\ or 0.0 (if supported),  or an implementation-defined value
45
shall be returned.
46
.LP
47
If
48
\fIx\fP or \fIy\fP is NaN, a NaN shall be returned. 
49
.SH ERRORS
50
.LP
51
The \fIfdim\fP() function shall fail if:
52
.TP 7
53
Range\ Error
54
The result overflows. 
55
.LP
56
If the integer expression (math_errhandling & MATH_ERRNO) is non-zero,
57
then \fIerrno\fP shall be set to [ERANGE]. If the
58
integer expression (math_errhandling & MATH_ERREXCEPT) is non-zero,
59
then the overflow floating-point exception shall be
60
raised.
61
.sp
62
.LP
63
The \fIfdim\fP() function may fail if:
64
.TP 7
65
Range\ Error
66
The result underflows. 
67
.LP
68
If the integer expression (math_errhandling & MATH_ERRNO) is non-zero,
69
then \fIerrno\fP shall be set to [ERANGE]. If the
70
integer expression (math_errhandling & MATH_ERREXCEPT) is non-zero,
71
then the underflow floating-point exception shall be
72
raised.
73
.sp
74
.LP
75
\fIThe following sections are informative.\fP
76
.SH EXAMPLES
77
.LP
78
None.
79
.SH APPLICATION USAGE
80
.LP
81
On implementations supporting IEEE\ Std\ 754-1985, \fIx\fP- \fIy\fP
82
cannot underflow, and hence the 0.0 return value
83
is shaded as an extension for implementations supporting the XSI extension
84
rather than an MX extension.
85
.LP
86
On error, the expressions (math_errhandling & MATH_ERRNO) and (math_errhandling
87
& MATH_ERREXCEPT) are independent of
88
each other, but at least one of them must be non-zero.
89
.SH RATIONALE
90
.LP
91
None.
92
.SH FUTURE DIRECTIONS
93
.LP
94
None.
95
.SH SEE ALSO
96
.LP
97
\fIfeclearexcept\fP() , \fIfetestexcept\fP() , \fIfmax\fP() , \fIfmin\fP()
98
, the Base Definitions volume of
99
IEEE\ Std\ 1003.1-2001, Section 4.18, Treatment of Error Conditions
100
for
101
Mathematical Functions, \fI<math.h>\fP
102
.SH COPYRIGHT
103
Portions of this text are reprinted and reproduced in electronic form
104
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
105
-- Portable Operating System Interface (POSIX), The Open Group Base
106
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
107
Electrical and Electronics Engineers, Inc and The Open Group. In the
108
event of any discrepancy between this version and the original IEEE and
109
The Open Group Standard, the original IEEE and The Open Group Standard
110
is the referee document. The original Standard can be obtained online at
111
http://www.opengroup.org/unix/online.html .