My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Featured
Downloads
Links

I'm not sure if you're aware of Google's built-in calculator, but it's totally awesome. It does all sorts of basic calculations, almost any unit conversion you can dream up, and for you programmers, it's great for doing base conversions. But opening a web browser to http://www.google.com just to make sure you converted 0x34 to decimal in your head correctly, isn't always convenient (this is of course assuming that no other calculators exist, such as bc).

So, I threw together a very simple command line interface to Google Calculator — aptly named gcalc. It's also a good example of how Cocoa's powerful classes can let you whip up useful tools quickly, much like a scripting language. The help screen shows some example usages:

$ gcalc
gcalc version 0.5 by Greg Miller

Usage: gcalc [-d] <calculator query>

example:  gcalc "5+2*2"
example:  gcalc 5!
example:  gcalc "sqrt(-4)"
example:  gcalc "160 pounds * 4000 feet in calories"
example:  gcalc avogadros number
example:  gcalc 0b110111010 + 0x33 in decimal
example:  gcalc 22 lira in yen
example:  gcalc 2 to the power of 5

(From the original blog post at http://unixjunkie.blogspot.com/2006/10/google-calculator-from-command-line.html)

Powered by Google Project Hosting