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