复杂(8)的CABS(x)函数 [英] CABS(x) function for complex(8)
问题描述
是否存在双精度复数值的绝对值函数?当我尝试CABS()
我得到
Is there an absolute value function for a complex value in double precision? When I try CABS()
I get
V(1,j) = R(j,j) + (R(j,j)/cabs(R(j,j)))*complexnorm2(R(j:m,j))
错误:(1)中对'cabs'的调用中参数'a'的类型应为 COMPLEX(4),而不是COMPLEX(8)"
"Error: Type of argument 'a' in call to 'cabs' at (1) should be COMPLEX(4), not COMPLEX(8)"
我已经读过一个叫做CDABS()
的函数,但是我不确定那是同一回事吗?
I have read there's a function called CDABS()
but I wasnt sure if that was the same thing?
推荐答案
除了ABS()
外,没有其他原因.内在过程的泛型已经在FORTRAN 77中提供.您可以将它们用于所有内在数字类型.
There is no reason using anything else than ABS()
. Generics for intrinsic procedures were already present in FORTRAN 77. You can use them for all intrinsic numeric types.
如果要查看通用ABS()
的可用特定功能表,请参见 https://gcc.gnu.org/onlinedocs/gfortran/ABS.html ,但它们仅在作为实际参数传递时才非常有用.您会看到CDABS()
是非标准扩展名,我不建议使用它.
If you want to see the table of available specific functions of the generic ABS()
, see https://gcc.gnu.org/onlinedocs/gfortran/ABS.html , but they are mostly useful only to be passed as actual arguments. You can see that CDABS()
is a non-standard extension and I do not recommend to use it.
这篇关于复杂(8)的CABS(x)函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!