java fmal_fma、fmaf、fmal
fma、fmaf、fmalfma, fmaf, fmal
9/1/2020
本文內容
將兩個值相乘,添加第三個值,然后對結果進行舍入,而不會因中間舍入而丟失任何精度。Multiplies two values together, adds a third value, and then rounds the result, without losing any precision due to intermediary rounding.
語法Syntax
double fma(
double x,
double y,
double z
);
float fma(
float x,
float y,
float z
); //C++ only
long double fma(
long double x,
long double y,
long double z
); //C++ only
float fmaf(
float x,
float y,
float z
);
long double fmal(
long double x,
long double y,
long double z
);
#define fma(X, Y, Z) // Requires C11 or higher
參數Parameters
x-bladex
要相乘的第一個值。The first value to multiply.
誤差y
要相乘的第二個值。The second value to multiply.
zz
要相加的值。The value to add.
返回值Return Value
返回 (x * y) + z。Returns (x * y) + z. 然后使用當前舍入格式舍入返回值。The return value is then rounded using the current rounding format.
否則,可能返回以下值之一:Otherwise, may return one of the following values:
問題Issue
返回Return
x = 無限大、 y = 0 或x = INFINITY, y = 0 or
x = 0、 y = 無限大x = 0, y = INFINITY
NaNNaN
x 或 y = 精確的±無限大, z = 無窮大,正負號x or y = exact ± INFINITY, z = INFINITY with the opposite sign
NaNNaN
x 或 y = NaNx or y = NaN
NaNNaN
not (x = 0, y= 不定) , z = NaNnot (x = 0, y= indefinite) and z = NaN
not (x= 不定, y= 0) , z = NaNnot (x=indefinite, y=0) and z = NaN
NaNNaN
溢出范圍錯誤Overflow range error
± HUGE_VAL、± HUGE_VALF 或± HUGE_VALL±HUGE_VAL, ±HUGE_VALF, or ±HUGE_VALL
下溢范圍錯誤Underflow range error
舍入后的正確值。correct value, after rounding.
按 _matherr 中所指定的報告錯誤。Errors are reported as specified in _matherr.
備注Remarks
由于 c + + 允許重載,因此你可以調用采用并返回和類型的 fma 的重載 float long double 。Because C++ allows overloading, you can call overloads of fma that take and return float and long double types. 在 C 程序中,除非使用 宏調用此函數,否則 fma 始終采用并返回 double 。In a C program, unless you're using the macro to call this function, fma always takes and returns a double.
如果使用 fma() 宏,則參數的類型將決定選擇哪個版本的函數。If you use the fma() macro, the type of the argument determines which version of the function is selected. 有關詳細信息,請參閱 類型-泛型數學 。
此函數計算值就好像它采取了無限精度,然后將最終結果舍入。This function computes the value as though it were taken to infinite precision, and then rounds the final result.
默認情況下,此函數的全局狀態的作用域限定為應用程序。By default, this function's global state is scoped to the application. 若要更改此項,請參閱 CRT 中的全局狀態。
要求Requirements
函數Function
C 標頭C header
C++ 標頭C++ header
fma、 fmaf、 fmalfma, fmaf, fmal
fma 宏fma macro
有關其他兼容性信息,請參閱兼容性。For additional compatibility information, see Compatibility.
另請參閱See also
總結
以上是生活随笔為你收集整理的java fmal_fma、fmaf、fmal的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Xilinx Ultrascale 多通
- 下一篇: avx2 fma_fma()函数以及C