Noeud:Fortran and Satellites, Noeud « Next »:, Noeud « Previous »:Joe Package Version 0.1, Noeud « Up »:Why write tests?



Fortran, Antennae and Satellites

(FIXME: Can't find the reference to this adventure..)

In Fortran an identifier doesn't need to be declared:

A satellite driving software was written in Fortran; one of its tasks was extending the antenna once on orbit. An excerpt of the program that was to be written is presented below, together with it C equivalent for our non Fortran fluent readers:

                                       int I;
                                       ...
           DO 1 I = 1, 5               for (I = 1; I <= 5; ++I)
                                       {
         C Extend the antenna.           /* Extend the antenna. */
           ...                           ...
         C If antenna is extended        if (antenna_is_extended)
         C Then Go to 2                    goto 2
           ...                           ...
        1 CONTINUE                     }
        2 ...                          2:...
     
     Example 12.1: Extending a Satellite Antenna in Fortran
     

This code intends to try five times to open the antenna before giving up. When tested on the ground, the antenna always opened at the first try.

Unfortunately the actual program had a dot instead of a comma in the loop statement, and because of a single character typo the meaning is completely different:

                                       float DO1I;
                                       ...
           DO 1 I = 1. 5               DO1I = 1.5;
     
         C Extend the antenna.         /* Extend the antenna. */
           ...                         ...
         C If antenna is extended      if (antenna_is_extended)
         C Then Go to 2                  goto 2
           ...                         ...
        1 CONTINUE
        2 ...                          2: ...
     
     Example 12.2: Not Extending a Satellite Antenna in Fortran
     

The antenna was not extend at the first and only try, the satellite was lost.