重新编译旧的 Fortran 程序并出现此错误
代码部分如下所示;
DO i = 1 , no2 + 1
IF ( Isign.EQ.1 ) THEN
Ans(i) = fft(i)*Ans(i)/no2
ELSEIF ( Isign.EQ.-1 ) THEN
IF ( ABS(Ans(i)) .EQ. 0.0 )
& PAUSE ' deconvolving at responce zero in convlv'
Ans(i) = fft(i)/Ans(i)/no2
ELSE
编译器给我这个错误; IF ( ABS(i)).EQ。 0.0) ^ 在 (^) 和 (^) 处的表达式之间键入不一致
IF ( ABS(i)).EQ. 0.0)
^
invalid form for IF statement at (^)
有人可以告诉我如何正确编写此“固有函数”行来解决此错误吗? 我是编程新手,任何帮助都会很棒!我正在使用 GNU G77 编译器,如果 这很重要吗?谢谢
The section of code looks like this;
DO i = 1 , no2 + 1
IF ( Isign.EQ.1 ) THEN
Ans(i) = fft(i)*Ans(i)/no2
ELSEIF ( Isign.EQ.-1 ) THEN
IF ( ABS(Ans(i)) .EQ. 0.0 )
& PAUSE ' deconvolving at responce zero in convlv'
Ans(i) = fft(i)/Ans(i)/no2
ELSE
The compiler is giving me this error;
IF ( ABS(i)).EQ. 0.0)
^
Type disagreement between expressions at (^) and (^)
IF ( ABS(i)).EQ. 0.0)
^
invalid form for IF statement at (^)
Can someone tell me how to write this "Intrisic function" line correctly to solve this error?
I am new to programing and any help would be great! I am using the GNU G77 compiler if
that matters? Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在第二个错误语句中看到右括号多于左括号
另外,Ans(i) 和 0.0 的类型和种类是什么?我记得 Fortran 对于类型转换可能有点奇怪。
I see more right brackets than left ones in the second error statement
Also, what is the type and kind of Ans(i) and of 0.0? I remember fortran can be a bit strange about type conversions.
请声明。它们使世界变得不同!
将某些东西与十进制零进行比较是一种非常糟糕的做法。它
将其与容许误差值进行比较几乎总是更好(其中
应该足够小)。
如上所述,尝试编写一个小的可编译示例,其中
产生相同的错误并将其发布。
Declarations, please. They make a world of difference!
Comparing something to a decimal zero is a very bad practice. It
is almost always better to compare it to a value of tolerated error (which
should be made small enough).
With the above said, try writing a small compilable example which
produces the same error and posting it.