A view from the shoulders of the giants
Alright, enough talking about sub-$100 wristwatches. Well, how about sub-$5 scientific calculators?
Yes, you read me right. Sub-$5 scientific calculators. The most generic ones marketed as having 56 functions. The ones that can do complex numbers and base conversions, the ones that offer 12-digit internal precision even though they are only capable of displaying 10 digits at once. They do exist, they work fine, they last long enough to be useful. Sounds too good to be true? Maybe, but…
This beast that I have found in the parents’ cabinet drawer is my one and only Kenko I had been using since 2007 or even late 2006, but manufactured in 2004. Just get it: this dirt-cheap calc (I don’t remember its exact price but I reckon it wasn’t greater than $8 even then) turns 20 the next year but still works perfectly. Of course, not everything here got fully preserved since then. The first thing to break was the protective lid, and it happened in like 2010 or 2009 or even earlier. Several years later (I don’t remember when but definitely not after 2013) the clock’s display broke. Well, that was expected, those typical Chinese “Mode+Set” clock LCDs and boards never were of any quality, unlike the rest of the calculator. I remember my ultracheap 4-op Taksun I had used even before that, in the middle school, had also outlasted its built-in clock. What I should have done back then but didn’t do until now is to disassemble the case and just remove the central wire, which is a plus contact wire coming to the broken clock, just for it to not waste the energy. But I didn’t know back then that this clock was a totally independent circuit. This could have prevented the third problem — battery leakage that happened after all these years (remember, this Kenko still had the stock batteries installed at the factory since 2004 and still kinda worked although the digits were pretty unreadable). So, in January 2023, I cleaned the battery contacts as best as I could, tore off the clock’s plus wire, removed the keeper of the plastic lid latch that already was starting to just fall apart due to its age, reassembled the case and inserted two fresh AG10 batteries, et voila! The main display looks intact, all functions still work, and the keys, thanks to the ingenious transparent design, still look like new even without the lid. I wish such a design had also been used for the feature phone keypads after 2002, as I only remember Nokia 8310 and some Ericssons like SH888 to have such keys. I also remember simple (i.e. non-scientific) Chinese calculators with such keys being extremely popular among the salespeople on the markets and in small shops and convenience stores, because indeed, this makes the keypad virtually eternal and not wearing out regardless of the usage intensity.
Obviously, this Kenko KS-105B can do anything most scientific calculators could do long ago: parentheses (up to 15 levels of nesting), percentages, trigonometry (with degree/radian/gradian support and conversion between each other), logarithms (natural and decimal), exponents and roots, factorials and reciprocals, hyperbolic functions, the constants of π and e, polar and Cartesian coordinate conversion, fixed or floating-point entry, some statistical functions, even the basic complex number operations. However, there are several features here that aren’t present just everywhere but, in my opinion, make this cheapo one of the best hacker’s friends even though it has no bitwise operations or any programming mode. And the first such feature is, of course, the ability to directly work in the friggin’ hexadecimal. At least as long as we’re only working with integers. While the binary and octal base conversion is cool and all, it’s included more like for demonstration purposes, as we can only process up to 10 bits (including the sign bit) in the binary mode, which only gives us the effective range from -512 to 511. In the hex mode though, we can process the values from 0xFDABF41C01 (-9999999999) to 0x2540BE3FF (9999999999), just like in the decimal mode. But this gives us enough space to calculate all the memory or file offsets we need without any intermediate conversion, which is what I remember using this Kenko for about 10 years ago. I just didn’t feel like opening a dedicated calculator app or a browser console when I had a hex editor opened, and opted to use a working hardware solution. Yes, just like with the complex numbers, bin/oct/hex calculations here are limited to the basic integer arithmetic and memory register operations (interestingly enough, it truncates the fraction when reading a floating point number with
RM in any base other than decimal). But for the practical purposes, even the basic hexadecimal arithmetic is invaluable from time to time.
Next up is the (pseudo)random number generator called by
., i.e. the
RND function (note that it doesn’t match the meaning of the
Rnd function in Casio calculators where it means “rounding”; the random number generation function is called
Ran# in Casios). This generator returns a number from 0 to 1 with the 3-digit precision, which effectively equals to generating an integer from 0 to 1000 and then dividing it by 1000. It is just as interesting for me practically (as an independent randomness source for occasional use) as it is theoretically. Because even back then, it raised two questions from me: what is the algorithm behind it and why doesn’t it restart the same sequence after being turned off and then on, like in the MK-52, for instance? At first I thought I knew the answer to the second question and thought of the following: just like the memory register (the one we access with the
RM keys) and the degree-radian-gradian setting, the internal state of the PRNG is stored in a memory cell that can only be erased by removing the power source. And if we do this and reinsert the batteries, only then can we see the same sequence from the very beginning. But it turned out that’s not the case in this model. Even after reinserting the batteries I keep getting completely different results. So now, I really don’t know. Maybe the seeding is done by the first keypress time or the actual decimal dot key holding duration (because I really can hold it and get the calculation process somewhat longer than if I release it right away), maybe with something else or everything at once. I’ll definitely spend some time investigating this and maybe even will write a separate post about my findings, if and when there’s anything to write about.
Another function that I found very useful in the daily life is the bidirectional conversion between degrees (or hours), minutes and seconds and the decimal number of degrees/hours. Yes, this primarily was designed for geographic coordinates but can easily be used with time measurements just as well. Let’s imagine I have found out (using my AE-2000W‘s stopwatch, of course) that a process (say, charging some gadget with a solar panel) takes 1 hour 32 minutes 46 seconds, but I want to use this value in some further calculations, which is why I want to first convert it into just how many hours it is. So I enter 1.3246 and then press the
DEG key, getting 1.546111… as the result, meaning 1 hour 32 minutes 46 seconds is equal to 1.546111… hours. Now, let’s say I have used this value in my calculations and have come to some final result like, for instance, 32.742 hours, which I want to convert back to the usual H:M:S format. So I enter 32.742 and press
→D.MS) keys, getting the value 32.443120, which means 32 hours 44 minutes 31 seconds 200 milliseconds. Note that the supported conversion resolution here is only up to 10 ms (1/100th of a second) but that’s quite sufficient for most real-life use cases.
Speaking of real-life use cases, let’s explore one of my favorite examples: generating a random IMEI number with a given 8-digit TAC. That usually is required if we need to mimic some particular model on a cheap phone with a readily available IMEI editing code (I hope I have already written fairly enough about that here in the past, but in case you need a bit more up-to-date info, you can take a look at this page too) so we don’t have to use a PC or an OTG-enabled smartphone/tablet to do this editing anyway. So, let’s break down the process and see how this calculator can help us with it. First, we know that an IMEI has 15 digits and the last one of them is the check digit we don’t know yet, as we need to calculate it using the Luhn’s algorithm. So, we take our 8-digit TAC, generate the remaining 6 digits using the calculator’s
RND function twice (because it only outputs 3 digits at once) and then write all the 14 digits down as a single number and apply the following algorithm to it (note that it is optimized to only work for the even number of digits so that we don’t have to go from the end):
- Mark (e.g. underline) every second digit of the number, unless it is 0 or 9.
- Sum all the unmarked digits and save the result into the memory register with the
X→Mkey (or the
M+key if the memory register was empty before).
- Enter the first marked digit, double it. If the result is 10 or more (the digit is larger than 4), subtract 9. Append what you got to the overall sum using the
M+key. Repeat this step for every marked digit.
- Recall the sum with the
RMkey. Look at the last digit. If it’s 0, the check digit is 0. Otherwise, subtract it from 10 and get your check digit.
This particular Luhn implementation is interesting because it can easily be applied to non-scientific calculators as well, only the memory register is required here, we just won’t have a convenience of generating the missing random digits “on the fly”. Let’s see an example: we need to calculate the check digit for the incomplete IMEI 12345678901234. What do we do?
- Mark every second digit that isn’t 0 or 9: 12345678901234
- Sum all the unmarked digits and store the result:
1 + 3 + 5 + 7 + 9 + 1 + 3 = X→M
- Double all the marked digits, subtracting 9 when it overflows:
2 × 2 M+ 4 × 2 M+ 6 × 2 - 9 M+ 8 × 2 - 9 M+ 2 × 2 M+ 4 × 2 M+
- Recall the sum by pressing
RM: 63. Hence, the check digit is 10 - 3 = 7, and the full valid IMEI is 123456789012347.
Of course, this algorithm can be further optimized even more, like first summing all the digits once and then adding every second digit and subtracting 9 afterwards if the digit is 5 to 9. Or we could modify the initial algorithm to not worry about the subtraction of 9 by multiplying the marked digits by 2.2 instead of 2 (we would need to manually truncate the fractional part though, here it’s done most quickly with the
2ndf →HEX 2ndf →DEC sequence). For known TACs, we can also have the patrial sums precalculated so that we don’t have to process all the digits, only the last six which are generated randomly. Either way, practice makes perfect, and anyone can perfect their own approach to have less than 50 keystrokes per each IMEI calculation.
And now, after an overview of just a small percentage of what this device can do, here’s the real kicker: this calculator is still manufactured to this day (already having some other but similar model numbers, like Kenko KK-105B, Kadio KD-105B, Yin’s YS-105B, Gavao GA-105B, Taksun TS-105 and so on) and currently sold for around… $1 to $4 throughout the globe. I’m not kidding. This must be the highest bang-to-buck ratio I have ever seen in consumer electronics. Moreover, its mainboard (sans the terrible clock, of course) became the basis for hundreds of other modern low-budget OEM scientific calculator models, and that does not only include the Kenkos mentioned on the Sunway’s page as the “Scientific Calculator, 56 functions”, but also the ones from other suppliers that have kinda fresher design and power solutions (some have a single CR-type battery, some even have a working solar panel). And this basis is very easy to spot: if you see familiar
→DEC signs near the arithmetic operation keys and the
RND sign at the decimal point key and no additional functions at the digit keys, you can be sure it’s the same board (or at least the same chip) as in this 105B. Because no other calculator hardware in the world has this exact functional key configuration. Now, let me share the result of the famous
9 sin cos tan arctan arccos arcsin calculator test (in the degrees mode, of course) on the 105B, done according to the full procedure: 8.99999863704. This number is present on the test author’s page and matches the “generic 56-function scientific” entry, which lists Radio Shack EC-4038, Canon F-502 (not F-502G!) and Tozai ATC-828 amongst others, and the page was written in around 2003 so these devices came out even earlier, and this is exactly what I’m talking about, they are some of the oldest examples to use the same board/chip, which, by the way, might not even be manufactured by Sunway, that’s just all we know about it. I mean, the particular chip used in my Kenko. However…
…The real history of this platform, however, can be traced back to 1984 (how damn symbolic…), when Sharp released their EL-506P model that became so extremely popular that everyone started to clone it. Turned out it was released in two variants that were visually indistinguishable but had totally different hardware inside. And the chip in the older variant, the one from 1984 that still did have markings on it — Toshiba SC6992 — became the one to be copied most. Rumors are that the first company to successfully clone this chip was no one else but Samsung (see their CL-1070S model, for instance) who manufactured KS6041 and KS6042 chips (the former was even sold as a full pin-to-pin clone to replace the SC6992) that they, unlike Sharp/Toshiba, started shipping freely to Chinese companies. And before cloning these Samsung ICs themselves, these companies (like Truly) used them “as is” in their Sharp clones. So, you might think that what we have now is like a double carbon copy, and in terms of reliability it probably is, but believe it or not, not only does it pass the trigonometry tests with the same results as the SC6992-based calculators themselves, but also, if you press the
) keys down at the same time, it shows the same display bug as the original Sharp EL-506P from 1984 did! Now, that is something I call copying accuracy. I wonder whether the most recent and currently sold model on this platform from Sharp themselves, the EL-501X, still has the same bug. It would be just hilarious if it does. Although I do have a bit of doubt that modern low-budget Sharps are not just as OEM/ODM as modern Kenkos (as well as I doubt that the KS in my KS-105B model number directly refers to the Samsung’s IC clones, but everything is possible). Anyway, now I know where to look for the RNG secrets — in the SC6992’s or KS6041’s datasheets if there are any still left out there.
Given all this almost 40-year history, all the examples that old and the fact that even my KS-105B was manufactured in 2004, this raises a logical question: what kind of freshness could these new models introduce compared to the original, especially considering some of them them being more expensive? Well, I, for instance, plan to upgrade from this Kenko to another OEM model on the same chip but with a larger display and a lid that has an electrically erasable writing pad with a stylus (looks like this), where both the calculator and the pad eraser are powered by a single CR1616. I have seen one online but no store has imported it to my country as of yet. Even for the above example, it would make the process of generating random IMEIs based on the TACs much easier, as I would actually have all the digits in front of me all the time and then have them erased securely after the actual IMEI is generated and entered where it should. Other than that, it just looks like a very convenient way of jotting down intermediate calculation results without wasting any paper, and then getting rid of them with a single press of a button. But even without the pad, there still is something greater about these 56-function LCD cheapos than just a “disposable gadget” feeling. Even when you just want to buy the cheapest possible scientific calculator at a dollar store or the closest schoolware market, remember that all that became possible by standing on the shoulders of the giants, thanks to Japanese innovations of the past century and the great Sharp’s legacy that still lives on to this day.