I recently had a crazy idea about how engineers should be educated. They should be coached until they have reimplemented from scratch the software inside the Hewlett Packard HP48 calculator. It’s that simple.

hp48.png

I discovered the HP48 just after graduating from engineering school and I was sickened. I couldn’t believe this device which very clearly was designed to help kids claw their way to an engineering diploma existed. Every topic in my engineering studies was in that machine ready to help. I had struggled through the entire ordeal unarmed, oblivious to the existence of this heavy weapon.

You might think that a rewrite of all of that device’s superb software would be especially heavy on the programming. Yes. That is precisely why it is the perfect exercise for a modern engineer. And at the end of it all, the graduate would have a magnificent collection of self-made technology with which any engineering problem could be tamed.

Ya… Funny story. So it turns out that’s kind of what I’m doing.

I loved that HP48’s architecture so much that it was one of the main inspirations for my programming language, Geogad, which I have used every day for about 15 years as my personal calculator and heavy hitting math tool. Recently I’ve been getting into electronics more than ever and I’ve also been hitting a lot of broad topics in other kinds of engineering. This all means that I’ve been doing a lot of conversions from, say, picoFarads to microFarads and knots to meters per second, etc. All of this has made me nostalgic for the superb units handling features of the HP48. Of course I could not resist the overly clever impulse to reimplement all of that functionality.

Yes, I do know about thousands of simplistic online conversion utilities (e.g. "hey Google"). I also know about GNU Units — it is an incredible tool and if you have unit conversion problems, you should know about it too. But I needed something that was going to ultimately be a better fit with my programming language and so I got started writing a quick study to see how feasible it was.

And wow, that was quite a rabbit hole. Eventually I got something I feel good about and I thought that maybe I should also make it a standalone program so that people can check it out. Maybe it will prove to be helpful for someone. I packaged it up and called it Unicon.

unicon_logo200.png

You can check out its project page here.

You never know quite how many problems you can run into until you get a computer to help you uncover them; the number of bugs I had to deal with on this project was impressively high. Just typing in the entire HP48 units catalog by hand is going to produce more bugs than an anthill. There were subtle weird problems all over the place. Finally as I was starting to feel more confident that it was going to start working pretty reliably, I stumbled across this question: what is an electronVolt converted into kilocalories?

Fortunately I found this example on some random website that was demonstrating how to use Google to do units conversions. I put that value in my test harness and Unicon came back… wrong. Nothing shocking there, but it was slightly wrong.

Unlike in the real world, in computer work when you’re wrong but close, that is often quite weird. Usually when you’ve made a computer mistake, you’re way off. But here I was getting a similar looking answer that was not at all the right one. I checked some other online resources. Google reaffirmed. Wolfram Alpha concurred.

eV_wolfram.png

For me, the last word on these questions is always my beloved HP48. What did the old master say?

eV_hp48.png

Amazingly, the HP48 and the new Unicon agreed! It’s fine if I am wrong but the HP48? No. The HP48 is immaculate! It is never wrong! So that was a puzzle.

Pause here if you’d like to contemplate the answer to this conundrum before I tell you what the source of the error was.

I don’t know how I ever figured this out but I suspect a good deal of internet research was going on when I happened upon this wikipedia article: 2019 redefinition of the SI base units. [Yes, sic, just like that with weird capitalization.]

wtf.png

And sure enough, it turns out that an electronVolt had changed value in May of last year. Apparently all kinds of major changes were going on in the standards of fundamental physics. I may have to stop making fun of the philosophical problems with Avogadro’s number now.

How’s that for very weird? And the lesson there I guess is that even if your software is so badass and perfect that it never needs any updates ever, the universe in general is not so stable. So when people wonder why I don’t just stick with my old HP48 (or a very clever emulator thereof), this is as good of an answer as any.

There are no doubt more such mysteries to be solved and if you’re an engineer or physics person, I’d love some help. Go to the Unicon project page and give it a whirl. You just need some late-ish Python (probably 3.7+) and it’s easy to play with. I’d love to hear about your serious units conversion problems. If you find anything interesting, especially interestingly stupid, definitely let me know!