if-then-else
if-then-else copied to clipboard
Undefined behaviour in BINAC example
This whole thing is really fascinating. I noticed that the BINAC instructions specify what to do for IF (A) < 0
and IF (A) > 0
, but that leaves the behaviour for (A) == 0
undefined. It might be worth mentioning in the corresponding text, since it's treated as the "otherwise" case. I'd guess that they really meant IF (A) >= 0
there.
Thanks for pointing out the discrepancy. The BINAC documentation is not very clear on what happens when the accumulator contains 0. Given the reference elsewhere to a "sign digit," it sounds like numbers were probably represented in such a way that there were both positive and negative representations of 0, depending on how the 0 happened to have been calculated. The instruction probably looked only at the sign, so 0 could probably go either way depending on the circumstances.