Guy Steele
363
including as instructions, as character codes, as numbers, and so on. And in
order to convert the characters, I was feeding the data to various character-
conversion routines, one of which was designed for use after reading card
codes from a card reader. And I had overlooked the tiny footnote in the
specification that said, “We assume that before you call the procedure, the
buffer in which the card data will be read has all over the low order bits
cleared.” Or maybe had them set.
Anyway, the 12 bits from the card-code column were going into the high 12
bits of the 16-bit word and they were using the low bit for a clever trick
whereby you could call the card-reader routine asynchronously and it would
asynchronously load the buffer and the conversion routine would follow
behind, using that low bit to determine whether the next card column had
been read in or not. And if it had been read it would then convert that
character. Thereby, as soon as the card was read, very shortly thereafter
the conversion would finish—they were overlapping the cost of the card
conversion with the time it took to read the card. And I was feeding it raw
binary data that wasn’t obeying this constraint. And I had just overlooked
this—I thought it was yet another card-conversion routine but it turned out
this one had something special about its interface—it was relying on those
low-order bits, which ordinarily you wouldn’t think about. It was
interpreting what was in the buffer as saying, “Oh, the data has not yet
arrived from the card reader.” In principle I knew this, but it wasn’t
occurring to me. And then, as I say, it came to me while I was asleep. So
that was an odd case.
The other really interesting story I can think of was while I was the
maintainer of the Maclisp system and Maclisp supported bignums—integers
of arbitrary precision. They’d been around for several years and were
considered pretty well debugged and shaken out. They’d been used for all
kinds of stuff in Macsyma, and Macsyma users were using them all the time.
And yet a report came in from Bill Gosper saying, “The quotient of these
two integers is wrong.” And he could tell because the quotient was
supposed to be very near a decimal multiple of pi.
These were numbers about a hundred digits each and it really wasn’t
feasible to trace through the entire thing by hand because the division
routine was fairly complicated and these were big numbers. So I stared at