Alberto Fasso' sent us the following interesting f77 code:
CTHIS IS AN ILLUSTRATING EXAMPLE OF (ALMOST) STANDARD FORTRAN
CPROGRAMMING PRACTICE.
CTHE CODE SHOULD COMPILE AND RUN ERROR-FREE ON ALL STANDARD
CFORTRAN 77 COMPILERS.
DATA GOTO 7, GOTO 1, GOTO 5 /1029.,221591.,1048576./
GOTO (I)=MOD(NINT(GOTO 6)*NINT(GOTO 7)+NINT(GOTO 1),NINT(GOTO 5))
GOTO 2
1 WRITE(*,*) GOTO 8 ,' ===> ',GOTO 2 * 6 / GOTO 8
GOTO (6) ,NINT(GOTO 8 - GOTO 10) + 1
GOTO 9 = GOTO 9 * 2
GOTO (6,7) ,NINT(GOTO 3)
2 READ(*,*) GOTO 10
GOTO 2 = 0
GOTO 8 = -1
GOTO 9 = 2
GOTO 3 = GOTO 9 + GOTO 9
4 GOTO 4 = 0
5 GOTO 6 = GOTO (1)
GOTO 4 = GOTO 6 ** 2 / GOTO 5 ** 2 + GOTO 4
GOTO 3 = GOTO 3 + 1
GOTO (5,5) ,NINT(GOTO 3 - 2)
GOTO 3 = GOTO 3 - 3
GOTO 8 = GOTO 8 + 1
GOTO (1) ,NINT(GOTO 8 - GOTO 10) + 1
GOTO (1) ,NINT(GOTO 8 - GOTO 9) + 1
7 GOTO (4) ,INT(GOTO 4 ** 0.33333333)
GOTO 2 = GOTO 2 + 1
GOTO 4
6 END
I have tried cleaning it up to see what it does. Here is the result:
PROGRAM main
! .. Implicit None Statement ..
IMPLICIT NONE
! ..
! .. Local Scalars ..
REAL :: a, b, c, d, e, f, g
! ..
! .. Intrinsic Functions ..
INTRINSIC int, mod, nint
! ..
! .. Executable Statements ..
DO
READ (*,*) a
b = 0
c = -1
d = 2
e = d + d
DO
f = 0
DO
g = mod(nint(g)*1029+221591,1048576)
f = g**2/1048576.**2 + f
e = e + 1
IF (nint(e)<3 .OR. nint(e)>4) EXIT
END DO
e = e - 3
c = c + 1
IF (nint(c-a)==0 .OR. nint(c-d)==0) THEN
WRITE (*,*) c, ' ===> ', b*6/c
IF (nint(c-a)==0 .OR. nint(e)==1) STOP
d = d*2
IF (nint(e)/=2) EXIT
END IF
IF (int(f**0.33333333)/=1) b = b + 1
END DO
END DO
END PROGRAM main
Anyhow, this doesn't make matters much clearer. I have tried playing
around with the code, using different inputs, etc. but I can't figure
out what it is supposed to be accomplishing!
Alberto, or anyone else, can you enlighten me?
John
--
John Jeffrey Venier, B.A., M.Stat. Programmer Analyst III
Section of Computer Science Department of Biomathematics
The University of Texas M. D. Anderson Cancer Center, Houston, Texas
[log in to unmask] +1 713 792 2622
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|