Hacker News new | past | comments | ask | show | jobs | submit login

On a vaguely similar, yet less practical note: 111,111,111 * 111,111,111 = 12,345,678,987,654,321 :)



On most pocket calculators, 11111111×= will yield 12345678. People are often surprised that that sequence is accepted. To me, it exposes something about the calculator's internal architecture.

It's also a useful self-test if you think the battery might be going.


The sequence is a shortcut accepted by the vast majority of regular calculators for most of operations. It simply takes the second operand to be the same as the first and repeated pressing of the = key repeats the operation ad infinitum. Ie. 1+== is 3.

I have written an iOS calculator app and had very interesting times trying to find and mimic these shortcuts. I have thought for a long time they had to follow from some simple implementation detail, as all the calculators got them precisely the same, but I never found this one consistent rule, I had to implement the features in a series of hacks.


This site [1] reveals the secret to that pocket calculator shortcut and a few others, and also provides useful algorithms for calculating things such as square roots and logarithms.

[1] http://tedmuller.us/Math.htm


Wonderful! That site gives tests that can be performed from the keyboard to distinguish between Casio and non-Casio architectures, mentions the invisible 9th digit of precision, and notes that some calculators get it wrong.

The old Sinclair pocket calculators had some known arithmetic inaccuracies.


i'm interested now - what does that expose about the internal architecture for you?


Well, clearly the display is an addressable register, not merely an output through a latch.(I say that because I assume the design goals of an inexpensive calculator include kaizen-ing the bill of materials down to the absolute minimum. So it's probably a visible register. Similarly, it's probably a digit-serial architecture (maybe BCD), also for parts count reasons, but yielding supplemental advantages when it comes to verification.

Different operations take noticeably different amounts of time; a "timing attack" like those used for cryptanalysis might yield clues to what's in the black box.

The way new digits appear on the display when typed in suggests it might be implemented as a shift register. It would be interesting to look at high speed video of the display when the answer to a long computation appears; do the answer digits appear (rapidly) one at a time? Do they shift in from the left? Three caveats: (1) I've never noticed it happening; (2) LED displays are almost always multiplexed, but you could probably see through that; and (3) probably wouldn't work on an LCD because too slow. I used to have a vacuum fluorescent display calculator, though; IIRC it was not multiplexed.

There are a few articles on the web about the architecture of calculators, including the Busicom [1] and Sinclair [2]. Personally, I want to hear more about zoul's research---how did you do it?

[1] http://www.4004.com/

[2] http://files.righto.com/calculator/sinclair_scientific_simul...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: