rentzsch.com: tales from the red shed

Longhand

Rock
When I need to do some calculations, I used to use up to four different tools, depending on the task at hand.

For simple tasks, it was Calculator.app. Quick to launch and simple to use.

If the math and/or data is tabular, out came the spreadsheet module in AppleWorks (like Erik, I'm holding out hope for iWork).

For more involved math -- such as things that involve variables -- I'd launch Script Editor. AppleScript isn't the best math language (for example, it uses the wordy set x to 42 instead of x = 42), but it's always there and is easy to use.

When push comes to shove -- usually when I need large integers (AppleScript likes to represent anything over 500 million using scientific notation, which gives my brain unnecessary grief), I turned to the loathed command-line bc.

(Why do I hate bc? Two reasons: the dumb ABSOLUTELY NO WARRANTY banner it prints upon launch and the fact it catches control-c and tells you to type quit to exit. Either exit should exit, or it should honor my control-c (or both). Usually I simply close the entire Terminal window. I actually derive pleasure from force-killing bc that way. Die insolent software!)

Lately, I've been using Longhand, which has mostly replaced everything except the spreadsheet.

It's easier to use than Calculator.app (since it doesn't slavishly emulate a physical device, it's more like a word processor or toplevel). It supports variables, constants and even matrices. It also supports arbitrary large integers (go ahead, type in (2^64)-1 to get an idea of your G5's theoretical address space limitation).

Very nice, and free to boot.

Update: A lot of comments on bc. A bunch of folks informed me that control-d will exit bc (as well as a host of other programs (but of course not vi)). Jeremy Collins (who has a real flair for photography) points out I can suppress bc's ABSOLUTELY NO WARRANTY by using the -q switch (he even went so far as to populating my .bashrc with export BC_ENV_ARGS="-lq". He also writes:

Personally I prefer the stupid startup message because it clues me in that bc actually started. :) Without a message it just feels like the program is hanging.

Allan Odgaard puts the following in his .bash_profile::

? () { echo "$*" | bc -l; }

That way he can just write:

? 63*12-2

Which is kinda cool.

A bunch of folks also mentioned they use python as their calculator. I like python, but for whatever reason it doesn't spring to my mind before I have it done with Longhand.

Sadly, iWork does not include a spreadsheet. Yet.

Elliott Hughes responds at length. Yeah, I totally agree DVD Player is even more insolent than bc.

Saturday, January 08, 2005
12:00 AM