Quick simple mathematics calculations [duplicate]

Solution 1:

I'd start a python interpreter to perform such simple operations:

$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 100/9.14
10.940919037199125
>>> 

Please check this link for a list of python mathematical operators.

Solution 2:

Use bc, it does exactly what you want and it also has some other features, like variables, configurable input/output base (great for converting hex/dec/bin and so on) and others.

Solution 3:

The answer suggesting bc is certainly a good way to go. However, I like it even better with this simple wrapper, which I discovered quite serendipitously:

#!/usr/bin/env sh
#
# pbrisbin 2013 - see: https://github.com/pbrisbin/scripts/blob/master/calc
#
###
if which bc &>/dev/null; then
printf "scale=10; $*\n" | bc -l
else
awk "BEGIN { print $* }"
fi

As you can see, the idea was taken from pbrisbin.com, which is a site packed full of great ideas like these. (His goodsong script, e.g., made MPD become at least twice as awesome....)

Solution 4:

I would recommend/install synapse.

Ubuntu 12.04 and below: sudo apt-get install synapse
Ubuntu 14.04: Is synapse application launcher available?

Launch synapse by searching for it in the dash and go to the preferences menu. You can use the synapse indicator to access the preferences.

Once the window opens up, click the plugins tab and enable the Calculator plugin.

See below:

enter image description here

Once done, anytime you launch synapse using Ctrl + Space you can just start typing your calculation and the results will be displayed in realtime.

See below:

enter image description here