0

I have a gfortran error:

Warning: Obsolete: arithmetic IF statement at (1) 

What does this mean? In the source (old source):

66 s12 = max(epsilon, s1 + s2)
c Then execution will go to label 13. Will this stop any further problems?
if (s12 - 1.0) 13, 13, 12
13 z = s1 / s12
msw
  • 42,753
  • 9
  • 87
  • 112
Kuo-Hsien Chang
  • 925
  • 17
  • 40

3 Answers3

0

Check here:

http://www.ibiblio.org/pub/languages/fortran/ch1-5.html

"The Arithmetic IF is considered harmful."

Your statement,

if (s12 - 1.0) 13, 13, 12 is an Arithmetic IF, and is considered bad programming.

Almo
  • 15,538
  • 13
  • 67
  • 95
  • Thanks for the link. I changed them to the regular expression. if (s12 - 1.0 .LT. 0) then GOTO 13 else if (s12 - 1.0 .EQ. 0) then GOTO 13 elseif (s12 - 1.0 .GT. 0) then GOTO 12 endif – Kuo-Hsien Chang May 25 '12 at 19:37
  • Remember to choose by clicking the checkmark by one of the answers here if it in fact answered your question. Of course there's nothing wrong with not checking one if none of them answers well enough. – Almo May 25 '12 at 20:02
0

Arithmetic if is a peculiar feature of FORTRAN

it works as follows.

 IF (expr) label1, label2, label3

If the value of the expression is

less than 0, jump to label1 
equal to 0, jump to label2
greater than 0, jump to label3

In newer FORTRAN standards this feature is obsolete

In your code you can replace it with

      IF (s12 - 1.0 .gt. 0 ) GOTO 12
13    z = s1 / s12
Dima Chubarov
  • 16,199
  • 6
  • 40
  • 76
0

Quoth Wikipedia:

"..the Fortran statement defines three different branches depending on whether the result of an expression was negative, zero, or positive, in said order..."

"..was finally labeled obsolescent in Fortran 90."

msw
  • 42,753
  • 9
  • 87
  • 112