Namespaces
Variants
Views
Actions

std::fma

From cppreference.com
< cpp‎ | numeric‎ | math
Revision as of 23:02, 2 November 2012 by P12bot (Talk | contribs)

 
 
 
Common mathematical functions
Functions
Basic operations
(C++11)
(C++11)
fma
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)(C++11)(C++11)
Exponential functions
(C++11)
(C++11)
(C++11)
(C++11)
Power functions
(C++11)
(C++11)
Trigonometric and hyperbolic functions
(C++11)
(C++11)
(C++11)
Error and gamma functions
(C++11)
(C++11)
(C++11)
(C++11)
Nearest integer floating point operations
(C++11)(C++11)(C++11)
(C++11)
(C++11)
(C++11)(C++11)(C++11)
Floating point manipulation functions
(C++11)(C++11)
(C++11)
(C++11)
(C++11)(C++11)
(C++11)
Classification/Comparison
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
Macro constants
(C++11)(C++11)(C++11)(C++11)(C++11)
 

Template:ddcl list begin <tr class="t-dsc-header">

<td>
Defined in header <cmath>
</td>

<td></td> <td></td> <tr class="t-dcl-sep"><td></td><td></td><td></td></tr>

<tr class="t-dcl ">

<td >
float       fma( float x, float y, float z );
</td>

<td > (1) </td> <td > (since C++11) </td> </tr> <tr class="t-dcl-sep"><td></td><td></td><td></td></tr>

<tr class="t-dcl ">

<td >
double      fma( double x, double y, double z );
</td>

<td > (2) </td> <td > (since C++11) </td> </tr> <tr class="t-dcl-sep"><td></td><td></td><td></td></tr>

<tr class="t-dcl ">

<td >
long double fma( long double x, long double y, long double z );
</td>

<td > (3) </td> <td > (since C++11) </td> </tr> <tr class="t-dcl-sep"><td></td><td></td><td></td></tr>

<tr class="t-dcl ">

<td >
Promoted    fma( Arithmetic x, Arithmetic y, Arithmetic z );
</td>

<td > (4) </td> <td > (since C++11) </td> </tr> <tr class="t-dcl-sep"><td></td><td></td><td></td></tr>

<tr class="t-dcl ">

<td >
#define FP_FAST_FMA  /* implementation-defined */
</td>

<td > (5) </td> <td > (since C++11) </td> </tr> <tr class="t-dcl-sep"><td></td><td></td><td></td></tr>

<tr class="t-dcl ">

<td >
#define FP_FAST_FMAF /* implementation-defined */
</td>

<td > (6) </td> <td > (since C++11) </td> </tr> <tr class="t-dcl-sep"><td></td><td></td><td></td></tr>

<tr class="t-dcl ">

<td >
#define FP_FAST_FMAL /* implementation-defined */
</td>

<td > (7) </td> <td > (since C++11) </td> </tr> Template:ddcl list end

The fma functions compute (x*y) + z, rounded as one ternary operation, according to the rounding mode characterized by the value of FLT_ROUNDS.

4) If any argument has integral type, it is cast to double. If any other argument is long double, then the return type is long double, otherwise it is double.

5-7) If the macro constants FP_FAST_FMAF, FP_FAST_FMA, or FP_FAST_FMAL are defined, the function std::fma evaluates faster than the expression x*y+z for float, double, and long double arguments, respectively. If defined, these macros evaluate to integer 1.

Parameters

x, y, z - floating point values

Return value

(x*y) + z, rounded as one ternary operation

See also

Template:cpp/numeric/math/dcl list remainderTemplate:cpp/numeric/math/dcl list remquo