C++官网参考链接:https://cplusplus.com/reference/cmath/fma/
函数
<cmath> <ctgmath>
fma
C99
double fma(double x, double y, double z);
float fmaf(float x, float y, float z);
long double fmal(long double x, long double y, long double z);
C++11
double fma(double x, double y, double z);
float fma(float x, float y, float z);
long double fma(long double x, long double y, long double z);
double fma(Type1 x, Type2 y, Type3 z); // additional overloads
乘-加
返回x*y+z。
该函数在不损失任何中间结果的精度的情况下计算结果。
可以在实现中定义以下宏常量,以表明该函数通常比在x*y+z中执行算术运算提供了效率改进(例如当使用硬件乘-加指令时):
macro | description |
---|---|
FP_FAST_FMA | For argum |