At 15:49 30-08-2000 -0700, Alberto Fasso' wrote:
>
>On Wed, 30 Aug 2000, Walt Brainerd wrote:
>> Van Snyder wrote:
[ ... ]
>Anyway, since I mentioned GOTO jokes, here is one I met many years ago.
>The program compiles and runs correctly: just
>type in any number when it pauses.
! ^^^^^ ??? [JvO]
>
>Alberto Fasso'
>
>CTHIS IS AN ILLUSTRATING EXAMPLE OF (ALMOST) STANDARD FORTRAN
>CPROGRAMMING PRACTICE.
>CTHE CODE SHOULD COMPILE AND RUN ERROR-FREE ON ALL STANDARD
! Though it is not robust to any input :: [JvO]
>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 ! Possible Zero-divide
> GOTO (6) ,NINT(GOTO 8 - GOTO 10) + 1
> GOTO 9 = GOTO 9 * 2
> GOTO (6,7) ,NINT(GOTO 3)
> 2 READ(*,*) GOTO 10
Look what happens if you enter a number with |x| < 0.5
> GOTO 2 = 0
> GOTO 8 = -1 ! goto8 == -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 ! goto8 == 0
! so the 1 WRITE ... stumbles on Zero divide !!!
> 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
>
>
>--------------------------------------------------
>Alberto Fasso'
>Stanford Linear Accelerator Center
>Radiation Physics Dept. ms 48
>2575 Sand Hill Road
>Menlo Park, CA 94025
>
>Tel. +1 650 926 4062 Fax: +1 650 926 3569
--
Meilleures Salutations,
Kindest Regards,
/---
Jan van Oosterwijk
Computing Centre
Delft University of Technology
Postbus 354
2600 AJ Delft
Netherlands / Pays-Bas
mailto:[log in to unmask]
Phone: +31 15 278 50 17
Fax: +31 15 278 37 87
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|