Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Performance “使用电源操作”**&引用;Fortran语言中的乘法和多重乘法_Performance_Fortran_Operation - Fatal编程技术网

Performance “使用电源操作”**&引用;Fortran语言中的乘法和多重乘法

Performance “使用电源操作”**&引用;Fortran语言中的乘法和多重乘法,performance,fortran,operation,Performance,Fortran,Operation,你认为哪一个在Fortran中的运算速度更快 x**2 VS x*x x**3 VS x*x*x x**4 VS x*x*x*x x**5 VS x*x*x*x*x 我的建议是:为可读性编写代码。这将使您的程序正确无误,并在将来的维护中得到回报。现代优化编译器很可能会为您实现这些优化。。。甚至是你可能想不到的更聪明的。什么是X**4=(X*X)*(X*X)?使用(x*x)进行一次评估并存储?为什么不亲自尝试一下?

你认为哪一个在Fortran中的运算速度更快

x**2   VS   x*x
x**3   VS   x*x*x
x**4   VS   x*x*x*x
x**5   VS   x*x*x*x*x

我的建议是:为可读性编写代码。这将使您的程序正确无误,并在将来的维护中得到回报。现代优化编译器很可能会为您实现这些优化。。。甚至是你可能想不到的更聪明的。什么是
X**4=(X*X)*(X*X)
?使用
(x*x)
进行一次评估并存储?

为什么不亲自尝试一下?