blob: e613225d330934f1f8b424072329a48b3ce98be5 [file]
<html lang="en">
<head>
<title>fma - Untitled</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Untitled">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Math.html#Math" title="Math">
<link rel="prev" href="floor.html#floor" title="floor">
<link rel="next" href="fmax.html#fmax" title="fmax">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="fma"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="fmax.html#fmax">fmax</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="floor.html#floor">floor</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Math.html#Math">Math</a>
<hr>
</div>
<h3 class="section">1.21 <code>fma</code>, <code>fmaf</code>&ndash;floating multiply add</h3>
<p><a name="index-fma-53"></a><a name="index-fmaf-54"></a><strong>Synopsis</strong>
<pre class="example"> #include &lt;math.h&gt;
double fma(double <var>x</var>, double <var>y</var>, double <var>z</var>);
float fmaf(float <var>x</var>, float <var>y</var>, float <var>z</var>);
</pre>
<p><strong>Description</strong><br>
The <code>fma</code> functions compute (<var>x</var> * <var>y</var>) + <var>z</var>, rounded as one ternary
operation: they compute the value (as if) to infinite precision and round once
to the result format, according to the rounding mode characterized by the value
of FLT_ROUNDS. That is, they are supposed to do this: see below.
<p><br>
<strong>Returns</strong><br>
The <code>fma</code> functions return (<var>x</var> * <var>y</var>) + <var>z</var>, rounded as one ternary
operation.
<p><br>
<strong>Bugs</strong><br>
This implementation does not provide the function that it should, purely
returning "(<var>x</var> * <var>y</var>) + <var>z</var>;" with no attempt at all to provide the
simulated infinite precision intermediates which are required. DO NOT USE THEM.
<p>If double has enough more precision than float, then <code>fmaf</code> should provide
the expected numeric results, as it does use double for the calculation. But
since this is not the case for all platforms, this manual cannot determine
if it is so for your case.
<p><br>
<strong>Portability</strong><br>
ANSI C, POSIX.
<p><br>
</body></html>