Re: [OT] Commodore 64 BASIC (was: Interesting bug)

From: Keith Thompson (kst-u_at_mib.org)
Date: 04/22/04


Date: Thu, 22 Apr 2004 20:35:40 GMT

Dan.Pop@cern.ch (Dan Pop) writes:
> In <c681oo$qbq$2@oravannahka.helsinki.fi> Joona I Palaste
> <palaste@cc.helsinki.fi> writes:
> >I have never programmed in Fortran, but I think it was about the same
> >situation with the Fortran version Dan Pop grew up with.
>
> Nope, FORTRAN IV was much better than BASIC and the "new" logical IF
> statements were a great improvement over FORTRAN II's arithmetic IF
> statements (which were gotos with 3 destinations).
>
> Each program unit (main unit, functions and subroutines) had its own
> local variables and it could be made to "see" only the global variables
> it needed to see.
>
> Its main drawbacks, that survived until F90, were the fixed-form line
> format with purely numeric labels (characters beyond column 72 were
> silently ignored, to provide additional fun during debugging) and blanks
> being *completely* ignored in the statement field (starting in column 7),
> except inside "string" literals. Hence the (in)famous typo:
>
> DO 5 I = 1. 5
>
> (the period was supposed to be a comma) that led to the statement being
> parsed as:
>
> DO5I = 1.5
>
> i.e. a loop was replaced by an assignment to a bogus variable and the body
> of the loop was executed once instead of 5 times. This happened in a NASA
> program, but the consequences were minimal (a certain entity was evaluated
> with less precision than intended).

This is a classic bug story, about which a great deal of
misinformation has been propagated over the years. There's a good
explanation of this bug (and the unrelated programming glitch that led
to the loss of the Mariner 1 Venus probe) in an article posted to
comp.lang.fortran back in 1994.

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=CwDIEq.D70%40news.cern.ch

http://tinyurl.com/32fmf

The article was posted by some guy named "Dan Pop".

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
San Diego Supercomputer Center             <*>  <http://users.sdsc.edu/~kst>
Schroedinger does Shakespeare: "To be *and* not to be"


Relevant Pages

  • Re: [OT] Commodore 64 BASIC (was: Interesting bug)
    ... >situation with the Fortran version Dan Pop grew up with. ... Each program unit had its own ... of the loop was executed once instead of 5 times. ...
    (comp.lang.c)
  • Re: [OT] convert C code to Fortran
    ... >providing interfaces, creating the right headers and intelligent ... The real problem is that the solution is not portable. ... interfacing C and Fortran are highly system specific. ... Dan Pop ...
    (comp.lang.c)
  • Re: Interesting bug
    ... Dan Pop scribbled the following: ... My first programming language was FORTRAN II, ... >>which would probably have driven me to another field of endeavor ...
    (comp.lang.c)
  • Re: [OT] - propagation of incorrect information
    ... >If you spell FORTRAN as Ratfor. ... Dan Pop ...
    (comp.lang.c)
  • Re: About alternatives to Matlab
    ... But whether a single loop is faster than several BLAS calls does not ... Bad Fortran 95 can easily be 25% lower than well-tuned C99. ... NumPy can be slower than equivalent C by an order of magnitude. ... manipulated within Python, not the speed of python code using NumPy ...
    (comp.lang.python)

Loading