The following three algorithms don’t have
much in common except for two things: They
were implemented between 1949 and 1965—
during the so-called first generation of comput-
ing hardware—and they are good examples of
rigorous thinking. First, I explain Bresenham’s
algorithm and apply it to a fundamental process
of computer graphics—drawing a line on a
raster screen. Second, although there are sever-
al ways to calculate a square root, the square
root algorithm is interesting because it takes
advantage of hardware design. And, finally,
while the calculation of π goes back more than
2,200 years, Machin’s algorithm from 1706 is of
importance to the history of computing.
Bresenham’s algorithm
Cathode-ray tube (CRT) displays for com-
puters were developed principally along two
lines, vector and raster, until the 1970s, when
memory became inexpensive. Initially, the
advantage of a vector display was that it could
draw a line by passing its end points to analog
circuitry, which moved an electron beam across
the CRT. To draw a line on a raster display, on
the other hand, required calculating the loca-
tions of every point that the line passed
through and illuminating each one.
Raster technology won out when it became
economically feasible to draw a display in a
dedicated memory and refresh the CRT from it.
Even though raster computation is more com-
plicated, vector display time varied with the
complexity of the diagram, making realistic
animation, for example, impossible.
In the 1950s, the IBM 704 and 709 comput-
ers included a CRT display with an addressable
raster of 1,024 × 1,024 dots. Once illuminated,
a dot would persist on the screen for about two
seconds. The CPU—excessively slow by today’s
standards—controlled the display, which had
no refresh buffer. The 704, for example, had a
12-microsecond cycle, meaning that the fastest
instruction executed in 24 microseconds.
Floating-point calculations were much slower;
a floating divide instruction took 18 cycles, or
216 microseconds.
Each dot was activated by the program’s
building a 36-bit word containing the X- and Y-
address of the dot, with the X-address in bits
8–17 and the Y-address in bits 26–35 and “copy-
ing” the word to the CRT (see Figure 1).
Obviously, the fastest way to refresh the screen
was to create a word for each illuminated dot
and to set up a “copy” loop. However, the maxi-
mum memory size for the 704 was 32,000 words,
including the program, so prestoring all the dots
wasn’t always feasible.
In actual use, the visible CRT was a “slave” to
another unit in a black box with a shutterless
35-mm camera. The general purpose of this
arrangement was to enable the camera to take a
picture of the master screen by illuminating dots
only once. Nevertheless, the process of calculat-
ing the positions of dots was so slow that only a
few dots could be displayed before the first one
began to fade. There was a demonstration pro-
gram—a tic-tac-toe game—for the display, and
even this simple picture flickered badly.
It was in this context, around 1960, that
computer scientist Jack Bresenham
1
consid-
ered how to minimize the calculation time for
the dots that make up a line. For a line with a
slope between 0 and 1, the Y-difference
between consecutive points on a straight line
is less than or equal to 1. For the line between
X1,Y1 and X2,Y2, such that 0 ≤∆Y ≤∆X and
X1 < X2, the X-addresses of the dots are X1,
X1 + 1, X1 + 2, … , X2. If ∆X = X2 – X1 and
∆Y = Y2 – Y1, then for each step in X, the val-
ues of Y are Y1, Y1 +∆Y/∆X, Y1 + 2∆Y/∆X, … ,Y2;
but raster point addresses are integers, so we
10 IEEE Annals of the History of Computing 1058-6180/02/$17.00 © 2002 IEEE
Three Early Algorithms
Keith S. Reid-Green
Three well-known algorithms, implemented separately within a span
of 20 years, demonstrate the use of mathematics developed
hundreds of years ago.
Figure 1. This 36-bit word activates a dot of a raster display.