An overengineered (because it's fun) cross-platform CLI calculator app with a rich set of features.
It is handy if you need to do some quick calculations while hacking in the terminal - no need to open a calculator app of any kind.
The flow of the app is as follows:
- Go (version 1.22 or higher) if you want to build the app from the source code.
Download the latest release for your OS from GitHub.
- via Homebrew:
brew tap n0rdy/n0rdy
brew install calcli
To enable, add the following file /etc/apt/sources.list.d/fury.list:
deb [trusted=yes] https://apt.fury.io/n0rdy/ /
You can do this either manually or by running the following command:
echo "deb [trusted=yes] https://apt.fury.io/n0rdy/ /" > /etc/apt/sources.list.d/fury.list
If you experienced this error:
bash: /etc/apt/sources.list.d/fury.list: Permission denied
try to do the following:
sudo -i
# enter your password
echo "deb [trusted=yes] https://apt.fury.io/n0rdy/ /" > /etc/apt/sources.list.d/fury.list
# click Ctrl+D to exit
sudo apt update && sudo apt install calcli
To enable, add the following file /etc/yum.repos.d/fury.repo:
[fury]
name=Gemfury n0rdy Private Repo
baseurl=https://yum.fury.io/n0rdy/
enabled=1
gpgcheck=0
sudo yum install calcli
calcli
This will start the app in the interactive mode. Type your expression and press Enter to get the result.
Press Ctrl+C
or Esc
to exit the app.
Check the bottom of the screen for the help message with the list of available commands and hotkeys.
- basic arithmetic operations:
+
,-
,*
,/
,%
,^
,!
, as well as parentheses - integer and floating-point numbers (
.
as a decimal separator) - a set of predefined constants:
pi
,e
- math functions:
abs(x)
- the absolute value ofx
acos(x)
- the arccosine ofx
asin(x)
- the arcsine ofx
atan(x)
- the arctangent ofx
ceil(x)
- the smallest integer value greater than or equal tox
cos(x)
- the cosine ofx
exp(x)
- the value ofe^x
exp2(x)
- the value of2^x
floor(x)
- the largest integer value less than or equal tox
ln(x)
- the natural logarithm ofx
log(x, base)
- the logarithm ofx
to the specifiedbase
log2(x)
- the base-2 logarithm ofx
log10(x)
- the base-10 logarithm ofx
mod(x, y)
- the remainder of the division ofx
byy
nrt(x, degree)
- the root ofx
of the specifieddegree
percent(x, y)
- the percentage ofx
fromy
round(x)
- the value ofx
rounded to the nearest integersin(x)
- the sine ofx
sqrt(x)
- the square root ofx
tan(x)
- the tangent ofx
- the result of the previous calculation is stored in the variable
$pr
and can be used in further calculations - it is possible to persist the result of the calculation or a value in the variable and use it in further calculations
$var = 5 + 5
- calling
pmem()
system function will print all the variables stored in memory - review the history of calculations by pressing the
Up
andDown
arrow keys, or switching to the history mode by typing:h
and pressingEnter
- in history mode, press
/
to search for a specific expression in the history
Have fun! =)