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