C++ · APACHE-2.0 · ZERO RUNTIME DEPS

Math that lives
where you already live.

A deterministic command-line calculator for people who don't want to open a browser tab to solve for x. Expressions, base conversion, equations, matrices, and a scripting language for batch work — all in one static binary.

$ sudo snap install cli-calculator
cli-calculator --repl
// NO WRAPPER, NO WEBVIEW

One static binary.

No runtime beyond libstdc++. It works in CI, in a container, on a box with no display server — the same way it works on your laptop.

// SCRIPTABLE BY DESIGN

Built to be piped, not just typed.

--eval, --output json|yaml|xml, and batch files with control-flow directives mean it drops into scripts as easily as a REPL.

// STATE THAT PERSISTS

Variables survive the session.

Values live in vars.toml between runs, so a number you compute today is a name you can reuse next week.

CAPABILITIES

Six tools. One binary.

Every command below runs headlessly — no menu required — and every output shown is real.

cli-calculator --eval "2*(3+5)"

Expression evaluation

Arbitrarily long expressions with + - * / x :, parentheses, factorial, and functions like sin, log, sqrt, exp.

→ 16
cli-calculator --convert 10 16 42

Base conversion

Move signed integers between binary (0b), decimal, and hexadecimal (0x) in one call, in either direction.

→ 0x2A
cli-calculator --square-root 625

Equations, guided

Solves linear and quadratic equations — including complex roots — through guided prompts when you want the interactive menu.

→ 25
matrix add · subtract · multiply

Matrix workflows

Add, subtract, and multiply matrices of arbitrary size, with validation before every operation — no silent dimension mismatches.

→ from the interactive menu
cli-calculator --prime-factorization 32768

Prime factors & divisors

Factorization and divisor lookups optimized for large integers, available as single-shot flags or from the menu.

→ 2^15
cli-calculator --list-variables

Persisted variables

Inspect or edit values stored in vars.toml. Numerical flags accept variable names as arguments, so results chain across sessions.

→ reads vars.toml
BATCH SCRIPTING

A small language for repetitive math.

Batch files run a list of commands with directives for state and control flow — @set, @input, @include, @if, @unset — so a calculation you'd otherwise repeat by hand becomes a file you run.

Numerical flags accept variable names as arguments, so a batch run can hand its results straight to the next command.

1// tasks.txt
2@set rate = 1.0725
3@input principal "Starting amount:"
4@if principal > 0
5  principal * rate
6@include compound-steps.txt
7@unset rate
$ cli-calculator --batch tasks.txt --output json
Expressions
Matrices
Graphs
Notes
FOR WHEN YOU WANT TABS

The same engine, wrapped in a Qt GUI.

Same calculation core, different surface: tabs for expressions, numbers, conversions, equations, matrices, graphs, statistics, variables, and notes, plus an in-app terminal for when you want the CLI back.

  • Split view — open any two tabs side-by-side
  • Notes tab with a Markdown editor, live preview, and LaTeX-style symbols
  • Graphs tab generates PNGs from values or a CSV, saved anywhere on disk
  • An in-app terminal runs CLI calculator commands or shell commands from the workspace directory
INSTALL

Pick your path.

Packaged for Linux, or build the C++ source directly. Requires zlib.

any distro with snapd
$ sudo snap install cli-calculator
Setting up snap "cli-calculator" (2.0.1) ...
cli-calculator 2.0.1 installed
requires zlib
$ git clone https://github.com/Benedek553/cli-calculator.git
$ cd cli-calculator && make
g++ -O2 -lz -o cli-calculator src/*.cpp
build complete → ./cli-calculator
no menu required
$ cli-calculator --divisors 120
1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 20, 24, 30, 40, 60, 120
$ cli-calculator --no-color --eval "sqrt(2)"
1.41421356
Licensed under Apache-2.0 Report an issue on GitHub →