The following explains the “strange overflow numbers” that were being discussed on the HP Museum board May/June 2008.
CRASH YOUR HP-67
Turn on an HP-67, and press Sigma-minus, x-bar, %CH. The calculator will crash so badly that it can only be un-crashed by turning it off. What happened is that the NNN negative zero was placed in the Y register, and then divided by. The poor ’67, trying to divide by zero, goes into an infinite loop. Don’t worry; it doesn’t hurt the calculator.The offending negative zero mentioned in the previous paragraph can be dumped into the X register, non-normalized, because of a bug in the STK command. After creating it (see above), press STK, wait for -0 to appear (the Y register), and then press a key to interrupt the rotating stack. The -0 can be stored into any register you wish... but recalling it to X via ordinary means will immediately normalize it. Interesting factoid: storing -0 into the I register, when used for indirect branching, performs a “rapid-reverse-branch” zero steps!
NNN’s: THE INSIDE STORY
The “strange overflow numbers” being discussed here were called “NNN’s” in the old days of calculator club activity. NNN means “non-normalized numbers”. They are NOT “special format numbers” as some here have guessed. They are numbers with the same internal format as any other number, but with unusual values in the sign nibble, mantissa nibbles, or exponent nibbles. The same has been true for all HP programmable calculators. NNN’s are easy to create on the 49g+ and 50g, using functions in the built-in “developer’s library”, library 256.All HP programmable calculators store numbers in this internal format:
S MMMMM XXX
S is a one-nibble field (0 through hex F) that stores the mantissa’s sign, with 0 indicating positive, and 9 indicating negative. If the sign byte is anything other than 0 or 9, the number is an NNN. Most calculator operations (but not all) “normalize” the sign byte to a 0 or 9. For example, ABS and X^2 always coerce the sign nibble to a 0.
MMMM is the string of bytes that stores the mantissa, with each nibble storing one decimal digit (0 through 9) of the mantissa. The number of nibbles in the mantissa field depends on the calculator. 10-digit calculators have a 10-nibble mantissa field; 12-digit calculators have a 12-nibble mantissa field. If any of the nibbles contain a hex A through hex F, then the entire number is an NNN. Once again, most calculator operations “normalize” the number, coercing all the mantissa digits back to 0 through 9.
XXX is a three-nibble field that stores both the exponent and its sign in an interesting way. 001 means an exponent of 1, and 999 means an exponent of -1. Thus XXX acts just like a 3-digit digital counter. With the counter at 000, counting one backwards would “wrap around” to 999. One more backwards count would put you at 998, meaning “back 2 from 000”, or -2. And so on.
The old HP calculators only allowed exponents in the -99 through +99 range. Therefore they limited the XXX field to go from 901 (-99) up to 099 (+99). Internal calculations often went beyond this range (e.g. squaring 10^60 (XXX=060) actually would get an answer of 10^120 (XXX=120), but upon finishing the calculation, when the the number was “normalized”, the “illegal” first digit of the exponent (1) would be caught, and the “out of range” error would be generated. If that digit was ever 5 through 8, then the answer was considered an underflow, and a 0 would be returned.
The HP-67 & ’97 were unusual in that numbers were only normalized in the display routine. The ’67 and ’97 were perfectly happy with creating NNN’s and leaving them, non-normalized, in the storage registers and stack registers (other than X, since X was always displayed). That’s why the ’67/’97 statistics functions create out-of-range numbers in the statistics registers. Thus you can easily create 10^120 using the statistics functions (e.g. x-bar, which can return an NNN to the Y register). You just can’t recall the NNN’s to the X register without normalizing them... USUALLY.
There is one way of dumping an NNN into X without normalizing it on the ’67 (not the ’97), but it depends on a bug in the STK function. As you know, the STK command (which displays the whole stack on the ’67) can be interrupted by pressing a key during the STK loop. But here is a surprise: If you create an NNN in the Y register using the x-bar function, and then execute STK, and then press a key while the Y register is being displayed, then that NNN gets dumped into the X register without being normalized. STK uses its own display code, which does NOT normalize numbers.
Such NNN’s were used by members of “The HP 65 User’s Club” (and, later, PPC members), to create things like very accurate countdown timers.
THE HISTORY OF NNN’s
NNN’s were first mentioned by Richard Nelson in the “65 Notes” newsletter (later known as the “PPC Journal”) in November 1974 (Volume 1, Number 7, Page 8... referred to in later articles as V1N7P8). Excerpt: “The numbers shown in Table 1 are non-normalized numbers whose sign bit [sic] is something other than 0 or 9.” Interesting uses for NNN’s included H. Schnepf’s Digital Clock program for the HP-65 in June 1976 (V3N5P7).NNN’s specific to the HP-67 were used extensively, because methods were discovered for using them to display text, even though the ’67 is only supposed to display numbers. My favorite example was Lou Cargile’s “Gerald, Ida, and Ella” program, which created three “artificial intelligence” characters with their own personality (Old Gerald, Easy Ida, and Dear Ella), who could talk with you or even with each other, in English! (Feb/Mar 1977, V4N2P16). NNN’s were avoided on the HP-97, because printing some NNN’s turned on the printhead’s tiny resistors and left them on, causing the printhead to start smoking in just a few seconds and then burn out, permanently destroying the printer (first reported in January 1977, V4N1P13).
The “Crash Your HP-67” routine mentioned at the top of this posting appeared in PPC Journal V7N3P32. That was April 1980. I’d tell you who the author was, but modesty prevents me.
-jkh-