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 |
宏 | 说明 |
FP_FAST_FMA | 对于double类型的参数,它的执行速度通常与x*y+z差不多,甚至更快。 |
FP_FAST_FMAF | 对于float类型的参数,它的执行速度通常与x*y+z差不多,甚至更快。 |
FP_FAST_FMAL | 对于long double类型的参数,它的执行速度通常与x*y+z差不多,甚至更快。 |
C99 | 头文件<tgmath.h> 提供了该函数的泛型类型宏版本。 |
C++11 | 这个头文件(<cmath>)为其它算术类型组合提供了额外的重载 (Type1,Type2和Type3):这些重载在计算前将其参数转换为double, 除非至少一个参数的类型是long double(在这种情况下,它们都被转换为long double)。 |
/* fma example */ #include <stdio.h> /* printf */ #include <math.h> /* fma, FP_FAST_FMA */ int main () { double x,y,z,result; x = 10.0, y = 20.0, z = 30.0; #ifdef FP_FAST_FMA result = fma(x,y,z); #else result = x*y+z; #endif printf ("10.0 * 20.0 + 30.0 = %f\n", result); return 0; } |
fmin | 最小值(function ) |
fdim | 正差(function ) |