There have been lots of times in the past where a good programmer-oriented calculator would've saved me a lot of time. Lately, I've been doing quite a lot of bit manipulation, and having to do build/run to debug my calculations feels really slow. I've looked for something like this in the past, but found nothing that worked very well. The only thing that comes close is this one from AnalogX, but I can't get it to work or really do anything on my vista box which is where I'm doing most of my work at the moment. (btw - please send comments about my vista usage here;).

Anyway, I'm looking for something for simple calculations using a C-like syntax with support for proper precenedce, operators, etc. Bonus points for cross-platform.

The python interpreter was a great idea and is totally cross-platform. For windows only SpeQ is amazing. Thanks for the suggestions.

+45  A: 

Whenever I need calculator-type stuff I just fire up the python interpreter. In fact, the python tutorial has a chapter which uses its calculator-like functions to introduce the language. The startup time is about 2s on my old n' busted laptop.

EDIT: and since you are interested in bit manipulation, note that the built-in hex() function will spit out the argument represented in hexadecimal.

very interesting - checking it out now. thanks
+1 on using the python interpreter.
Aaron Maenpaa
cool - thanks. this works great. vista was fighting the installer, so I'm using it through my linux box.
Python work great on my Vista 64 bits.
You could add that Python has binary literals: 0b101010
J.F. Sebastian
IPython is the shell for Python:
J.F. Sebastian
Try out Reinteract! It is a shell for python that should make python an ideal calculator!!!
Daren Thomas
+6  A: 

An interactive Python shell works great as a calculator. It has all of the usual operators, although instead of overflowing integers, it automatically converts overflowed calculations into longs (i.e. bignums).

Adam Rosenfield
+10  A: 

I use "bc -l". Works on Linux, all flavours of Unix and Mac OS X.

Paul Tomblin
It'd be _perfect_ if `bc` could do base conversions, too...
@fbrereto, look up "ibase", "obase" in the bc man page.
Paul Tomblin
@Paul, cool, thanks!

PCalc is what I use.

Paul Nathan
+13  A: 

I've been using SpeQ, might fit your needs:

This is really cool. thanks
+3  A: 

Being a happy owner of first HP48G and now HP50g calculators, I came to love RPN and stack. The closest thing to such calculator that I've found on a PC is emacs calculator (bundled with emacs 22 or greater).

+3  A: 

If you want a calculator with C-like syntax and precedence, I'd recommend gdb (GNU Debugger).

Why vote this down? This answer could use more explanation, but it's not fundamentally wrong or unhelpful.
@bk1e: I agree; I really wish downvotes required you to add a reason (even an anonymous one).
Software Monkey
There is a uservoice ticket for this:
+3  A: 

For programmers I think Stack Oriented languages can be a great tool.

Several such languages let you use Reverse Polish Notation (RPN) for specifying accurate evaluation order without brackets.

Forth is one such language with several implementations and interactive interpreters for several platforms.

The downside of using it off-course is you cannot simply copy-paste the code into your programs in C like languages that use infix notation. But I think a simple function can be written in Forth to spit-out an infix formatted expression.

BTW, my personal favorites are spread sheet programs like MS Excel or Open Office Calc.

Tahir Akhtar
+2  A: 

Speedcrunch springs to mind. Sadly, I don't think it lets you define functions in the normal input. But it supports variables and has a wide range of builtins.

If you want something more scientific/hard-core, there is always GNU Octave. Several windows ports can be found on

Edit: typo

+22  A: 

You may laugh (or downvote me into oblivion), but you can actually do logical operations (AND, OR, NOT, XOR) on numbers in binary, hex, etc. using the fantastic......Windows calculator!

<DeadPanVoice>But that would not be geeky enough.</DeadPanVoice>
I didn't buy a Microsoft Ergonomic keyboard for the application buttons (home, search, mail, etc.), and I find them to be mostly superfluous. However, I have to admit that I use the calculator button all of the time.
Man, I use the Windows Calculator for stuff like this *every day.* And here I thought I was the only one!
So do I - the View/Scientific option is a wonderful thing!
Software Monkey
Windows 7's calc even has a "programmer" mode...
Windows bashing is always fun, but I give them high marks for their scientific/programmer calculator.
The Windows 7 calc "programmer mode" is exactly why I searched for this thread... apparently the writers were under the assumption that programmers do not use decimals...
+2  A: 

The PowerShell command prompt is an alternative to Python for the Windows .Net developer. Using the System.Math namespace, you have lots of functions to play with. Add in the PowerTab extensions and you have (almost) Intellisense as well.

A degree of portability is available via Pash (PowerShell open source reimplementation for "others" - Mac, Linux, Solaris, etc...)

Dan Blanchard

For this kind of thing I use the Firebug console. For hex or (any other base), use number.toString(16)

+7  A: 

A few more calculator replacements that come to mind:

Ruby's irb module

irb is an interactive interpreter for the Ruby language.

irb(main):001:0> printf "%#08x\n", 0xdeadbeef & (~0<<16)
=> nil

GDB (The GNU Project Debugger)

As suggested by JesperE, GDB has an interactive expression evaluator that supports C-like syntax.

(gdb) printf "%#08x\n", 0xdeadbeef & (~0<<16)

WinDbg (The Windows Debugger)

Like GDB, the Debugging Tools for Windows debuggers (WinDbg, NTSD, etc.) have an interactive expression evaluator that supports C-like syntax. Unlike GDB, they are Windows-specific. Also unlike GDB, you have to choose something to debug, but opening up an ordinary EXE like notepad.exe as a crash dump (using the menu or the -z option) will let you use the expression evaluator without starting a new notepad process.

0:000> ?? 0xdeadbeef & (~0<<16)
unsigned int 0xdead0000

GNU Octave

GNU Octave is an interpreted language for mathematical calculations. Its syntax isn't very C-like, but it has support for matrix math and graphing.

Microsoft Excel

For some situations, a spreadsheet is the best calculator replacement.

+2  A: 

instacalc is an online calculator. It supports a lot of scientific/programmer calculations including the bitwise operations: and or xor not << >> (see the drop down box where it says Basic Math) and can do line/bar charts. And once you've got your calculation worked out it's easy to share.

Sam Hasler
+2  A: 

Graphcalc is another option. There appears to be a Linux version also, but I haven't used it. Source code is provided for both editions.

Philip T.

I've used sage for a lot of this stuff (since it's essentially a python interpreter). There's even a free online version.

Jason Baker
+1  A: 

I use Matlab. You can use it for almost anything. It's a bit heavier, but being able to call an optimization tool box quickly is nice.

Matlab is the overlord of calculators! :)

I'm surprised that no one has mentioned Emacs Calc yet. Cross platform, built into my favorite editor, and easily handles anything I throw at it.


One of the first things I download on a fresh install is SuperCalc from James Brown's (fantastic) site

It takes up literally no real estate and it works great for my purposes.

Sean Bright
+1  A: 

Just and FYI, it looks like there's been an update to AnalogX's pcalc that might fix the issues with running under Vista, so you might want to give it another try.

It's my favourite little quick and dirty calculator too (even managed to get it working under WINE!)

thanks - I'll check it out.
+2  A: 

Use google!

2+2 = ?

Check out:

PowerCalc is good if you are on Windows. It also has a nifty graphing ability.


GNU octave - it runs on linux natively, has mac binaries, and can run on windows using cygwin. It is supposed to be like matlab - so you can pretty much do any kind of operation you want using it.

+1  A: 

I like Wolfram Alpha. Want to see how much data would be taken up, by, say, the population of the United States if every person required 1 MB? Instead of taking an extra step to look up the population, just search for "1 megabyte * population of united states"!


This may sound sad, but I miss bc ( on the unix platform sometimes.

That little app was a workhorse.


I can't believe no-one mentioned PARI/GP