日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

avx2 fma_fma()函数以及C ++中的示例

發布時間:2024/3/12 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 avx2 fma_fma()函数以及C ++中的示例 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

avx2 fma

C ++ fma()函數 (C++ fma() function)

fma() function is a library function of cmath header, it is used to find the result of multiply-add, it accepts three arguments and returns the result of the expression where first and second arguments will be multiplied and the third argument will be added to the multiplied result. It the arguments are x, y and z, it returns (x*y+z).

fma()函數是cmath標頭的庫函數,用于查找乘加結果,它接受三個參數并返回表達式的結果,其中第一個和第二個參數將相乘,第三個參數將被添加相乘的結果。 如果參數是x , y和z ,則返回(x * y + z) 。

Note: The fma() function computes and returns the exact result without losing precision.

注意: fma()函數計算并返回精確結果,而不會損失精度。

Syntax of fma() function:

fma()函數的語法:

fma(x, y, z);

Parameter(s): x, y, z – are the numbers to calculate the multiply-add.

參數: x,y,z –是用于計算乘加的數字。

Return value: double – it returns double value that is the result of x*y+z.

返回值: double-返回x * y + z的結果double值。

Example:

例:

Input:float x = 10.20;float y = 20.91;float z = 30.12;Function call:fma(x, y, z);Output:243.402

C ++代碼演示fma()函數的示例 (C++ code to demonstrate the example of fma() function)

// C++ code to demonstrate the example of // fma() function#include <iostream> #include <cmath> using namespace std;// main() section int main() {float x,y,z;float result;x = 1;y = 2;z = 3;result = fma(x,y,z);cout<<"result: "<<result<<endl;x = 10.20;y = 20.91;z = 30.12;result = fma(x,y,z);cout<<"result: "<<result<<endl; x = -10.21220;y = 20.9122;z = -30.1212;result = fma(x,y,z);cout<<"result: "<<result<<endl; return 0; }

Output

輸出量

result: 5 result: 243.402 result: -243.681

翻譯自: https://www.includehelp.com/cpp-tutorial/fma-function-with-example.aspx

avx2 fma

總結

以上是生活随笔為你收集整理的avx2 fma_fma()函数以及C ++中的示例的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。