I have to do basic arithmetic on a fairly regular basis. My tool of choice for the last few years has been LeanCalc. It does the job well for the most part, but it doesn’t ignore non 0-9 characters, I would commonly use it to calculate a percentage of a dollar value. I’d paste in something like $25,000.00 and want to multiply that by .015. WIth LeanCalc, I’d have to go back and delete the $ and , before it would give me an answer.

Soulver is a newer and much more powerful tool for this. It works exceedingly well. However, it’s more than I need and it’s something I’d have to maintain and upgrade on each of my machines. That got me thinking about a web-based solution – something I can invoke from LaunchBar with just a keystroke or two.

Last week I took an evening and did some experimenting with a JavaScript implementation. In a few hours I had a working prototype, then I spent a little more time cleaning it up so that it works “well enough” for my needs. You can see the result here and I’ve got the code up on GitHub.1


Creating this has been in the back of my mind for quite a while; little projects like this make developers happy. Here is a short “feature” list:

  • math is done by JavaScript, anything more than basic algebra is an accident
  • strips non-numeric garbage when evaluating (you can leave $ and , when pasting in your numbers)
  • the ENTER key from expression side takes you to result side and selects the result for easy copying
  • hit ENTER again (while in the result field) to get a new row
  • CTRL+N at any time will give you a new row
  • enter the result of one of the previous 10 rows (numbered) at the cursor position by using CTRL+(1-9)
  • numbers reset on every new row so that referencing the previous row is always 1, the second back is always 2, etc. (borrowed from LeanCalc)
  • if you get so many rows that they extend off the screen, the window automatically scrolls up like an old-school calculator tape
  • delete the current row with CMD+DELETE
  • the web page is a single HTTP request with gzipped response (CSS and JS are embedded)2

It works pretty much the way I want/need it to. I think it’s a short list of people that will find this to be a good solution for them; if you’re one of them – enjoy!

  1. While it defeats the purpose for me, some folks might want to use SimpleMath as a Fluid App. [back]
  2. I threw Google Analytics JS on my copy out of curiosity, obviously that’s not included in the GitHub version. [back]

This post is part of the project: SimpleMath. View the project timeline for more context on this post.