9103 opengroup acknowledgement should be properly formatted in man pages
[unleashed.git] / usr / src / man / man3m / fma.3m
blobca78bd9957e44cdf0052b119e41fdf72ad6441ee
1 .\"
2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group.  In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document.  The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
30 .\"
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
35 .\"
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 .\"
42 .\"
43 .\" Copyright (c) 2001, The IEEE and The Open Group.  All Rights Reserved.
44 .\" Portions Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved.
45 .\"
46 .TH FMA 3M "Jul 12, 2006" "SunOS 5.11" "Mathematical Library Functions"
47 .SH NAME
48 fma, fmaf, fmal \- floating-point multiply-add
49 .SH SYNOPSIS
50 .LP
51 .nf
52 c99 [ \fIflag\fR... ] \fIfile\fR... \fB-lm\fR [ \fIlibrary\fR... ]
53 #include <math.h>
55 \fBdouble\fR \fBfma\fR(\fBdouble\fR \fIx\fR, \fBdouble\fR \fIy\fR, \fBdouble\fR \fIz\fR);
56 .fi
58 .LP
59 .nf
60 \fBfloat\fR \fBfmaf\fR(\fBfloat\fR \fIx\fR, \fBfloat\fR \fIy\fR, \fBfloat\fR \fIz\fR);
61 .fi
63 .LP
64 .nf
65 \fBlong double\fR \fBfmal\fR(\fBlong double\fR \fIx\fR, \fBlong double\fR \fIy\fR, \fBlong double\fR \fIz\fR);
66 .fi
68 .SH DESCRIPTION
69 .sp
70 .LP
71 These functions compute (\fIx\fR * \fIy\fR) + \fIz\fR, rounded as one ternary
72 operation. They compute the value (as if) to infinite precision and round once
73 to the result format, according to the rounding mode characterized by the value
74 of \fBFLT_ROUNDS\fR.
75 .SH RETURN VALUES
76 .sp
77 .LP
78 Upon successful completion, these functions return (\fIx\fR * \fIy\fR) +
79 \fIz\fR, rounded as one ternary operation.
80 .sp
81 .LP
82 If \fIx\fR or \fIy\fR are NaN, a NaN is returned.
83 .sp
84 .LP
85 If \fIx\fR multiplied by \fIy\fR is an exact infinity and \fIz\fR is also an
86 infinity but with the opposite sign, a domain error occurs and a NaN is
87 returned.
88 .sp
89 .LP
90 If one of \fIx\fR and \fIy\fR is infinite, the other is 0, and \fIz\fR is not a
91 NaN, a domain error occurs and a NaN is returned.
92 .sp
93 .LP
94 If \fIx\fR*\fIy\fR is not 0*Inf nor Inf*0 and \fIz\fR is a NaN, a NaN is
95 returned.
96 .SH ERRORS
97 .sp
98 .LP
99 These functions will fail if:
101 .ne 2
104 \fBDomain Error\fR
106 .RS 16n
108 The value of \fIx\fR*\fIy\fR+\fIz\fR is invalid or the value \fIx\fR*\fIy\fR is
109 invalid.
111 If the integer expression (\fBmath_errhandling\fR & \fBMATH_ERREXCEPT\fR) is
112 non-zero, the invalid floating-point exception will be raised.
116 .ne 2
119 \fBRange Error\fR
121 .RS 16n
123 The result overflows.
125 If the integer expression (\fBmath_errhandling\fR & \fBMATH_ERREXCEPT\fR) is
126 non-zero, the overflow floating-point exception will be raised.
129 .SH USAGE
132 An application wanting to check for exceptions should call
133 \fBfeclearexcept\fR(\fBFE_ALL_EXCEPT\fR) before calling these functions. On
134 return, if \fBfetestexcept\fR(\fBFE_INVALID\fR | \fBFE_DIVBYZERO\fR |
135 \fBFE_OVERFLOW\fR | \fBFE_UNDERFLOW\fR) is non-zero, an exception has been
136 raised. An application should either examine the return value or check the
137 floating point exception flags to detect exceptions.
138 .SH ATTRIBUTES
141 See \fBattributes\fR(5) for descriptions of the following attributes:
146 tab(    ) box;
147 cw(2.75i) |cw(2.75i)
148 lw(2.75i) |lw(2.75i)
150 ATTRIBUTE TYPE  ATTRIBUTE VALUE
152 Interface Stability     Standard
154 MT-Level        MT-Safe
157 .SH SEE ALSO
160 \fBfeclearexcept\fR(3M), \fBfetestexcept\fR(3M), \fBmath.h\fR(3HEAD),
161 \fBattributes\fR(5), \fBstandards\fR(5)