开发者

Recompiling an old Fortran program and getting this error

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 erro开发者_如何学运维r? I am new to programing and any help would be great! I am using the GNU G77 compiler if that matters? Thanks


I see more right brackets than left ones in the second error statement

IF ( ABS(i)).EQ. 0.0)

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜