Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Had one years ago (on Win 3.1 or '95, I'm not sure). Anyways, it was a really simple program. Stood somewhere in PATH and enabled you to do something of a kind

calc 5 + 28.3*sqrt(12) 

and it spit out the result.

Anyone know of any such these days? Doesn't need to do anything fancy ... maybe it would just be nice if it had support for exponentials, but that's it.


p.s. Not interested in full blown solutions like Python or MATLAB.

share|improve this question
Which OS are you using? Many Operating Systems come with Perl pre-installed (if you're using Windows, you can use Strawberry Perl which is a very light-weight Perl distribution) and then create a shell script or a batch file called "calc" that is explained on this web page (this solution will handle complex math calculations for you too):… – Randolf Richardson Nov 17 '11 at 0:27
@RandolfRichardson - Sorry about that, always miss that part. Yeah, that's nice, but I'd rather see some up to two Mb solution, if such still exists. Portable Perl is nice, but 40Mb is hardly lightweight for a calc. – Rook Nov 17 '11 at 0:42
40 MBs now? Wow! That is rather heavy just for a calculator. =O – Randolf Richardson Nov 17 '11 at 0:46
if i could remember how to code... this might be a simple afternoon's project in the computing language of my choice ;p – Journeyman Geek Nov 17 '11 at 0:50
There is dc.exe in the gnuwin32 package, a port of the reverse polish notation command line calc for unix – MaQleod Nov 17 '11 at 1:23

A google search pops up a few command line calculators.

This one is written in C#

This one does graphs also.

share|improve this answer

You might be able to use some flavour of awk to do it - the link suggests creating a function like calc(){ awk "BEGIN{ print $* }" ;}' and then using the new function withcalc "equation here"`- you can get a copy of awk from unxutils or use busybox.Either of them should be quite easily under 1 mb

For basic addition/subtraction/mulitiplication and division... try the set /a command - more details here and using the help option

share|improve this answer

Google itself will perform such calculations in the search box or here. Not sure what limitations it has though. Depends what you want to use this for.

share|improve this answer

This started as a comment, but it became too long, so I post it as an answer.

You say you don't want Python, but Python would be quick and complete, and to compare Python and MATLAB in "full-blown"-ity is quite harsh. I believe it would also fare well speed wise compared the the C# and Perl suggestions among the comments and answers.

I use the one-liner:

python -ic "from __future__ import division; from math import *;"

which I've bound to a keyboard shortcut which opens a terminal with this command, which gives me a lightning-fast competent calculator with exp(), sqrt(), sin(), log(), pi, e, etc.

If you just want a "calc 5+7" variant, the *nix variete would be:

python -c "from __future__ import division; from math import *; print $*"

and on Windows you probably just need to replace $* with %*.

from __future__ import division makes division use floating point instead of integer division as default, which is expected of a calculator. This is not needed if one uses Python 3 (which is what the __future__ part means).

from math import * imports all math functions into the main namespace, so you can do sin(2*pi) instead of math.sin(2*pi).

As an encore: to have a script that can be started in either interactive or direct mode:

if [ ${#} = 0 ]; then
    python -ic "from __future__ import division; from math import *;"
    python -c "from __future__ import division; from math import *; print ${*};"

(most probably trivially converted to Windows).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.