2
1
Fork
You've already forked lcalc
1
A minimalistic command line calculator. Supports arbitrary precision, rational & complex numbers, basic operations & functions. Has a simple CLI with customizable look, as well as a man page documentation. Written in Zig.
  • Zig 100%
2025年08月16日 17:47:23 +03:00
demo Removed obsolete example 2025年08月12日 18:13:43 +03:00
man Moved all doc/items to man page, improving the said page in the process. 2025年08月01日 20:24:10 +03:00
src Implemented clipboard paste with Spiral editor 2025年08月12日 17:51:20 +03:00
.gitignore Removed old build system 2024年10月16日 01:13:43 +03:00
build.zig Updated version to 1.1.1 2025年08月04日 20:02:44 +03:00
build.zig.zon Updated version to 1.1.1 2025年08月04日 20:02:44 +03:00
CHANGELOG.md Moved version 1.1.1 2025年08月16日 17:47:23 +03:00
examples.md Basic editing? What? 2025年08月12日 19:18:09 +03:00
LICENSE Got rid of doc/ directory 2025年08月01日 20:28:44 +03:00
README.md Basic editing? What? 2025年08月12日 19:18:09 +03:00

Overview

lcalc — a command Line Calculator with arbitrary precision, inspired by bc and empowered by a family of GMP libraries. It can both be used in scripts, for medium–sized calculations, as well as in terminal with a nice CLI.

Features

  • Line-by-line calculation of mathematical expressions.
  • Integer (4), rational (7/3), floating (2.3) and complex (2 + 3i) numbers powered by GMP, MPFR and MPC.
  • Binary, (+, *, /, ...), unary (-, ...) operators.
  • Variables: x = 5.
  • Predefined constants: pi or π, e, and more.
  • Predefined functions: max(1, 2), sin(pi), ...
  • User–defined functions: csc(x) = 1/sin(x)
  • Intuitive syntax that's close to a math notation: 3x (2sin(z) / 4y)
  • Numbers in different bases: hexademical (0xFF), binary (0b10110), octal (0o777).
  • Modern, but simple interface with interactive editing powered by Spiral, syntax highlighting and themes.

Demonstration

See examples for a visual showcase.

Installing

Downloading a release

See releases page.

Every release comes with precompiled executable for specific OSes available for download. This executable is statically linked: this means it doesn't have system dependencies, but weights more.

Releases may also contain minisign signatures that can be verified with the following public key:

RWTW/iadZl5EZQtwd5E0HKfXXzjq6ePMGtKhz5VAPm7VLJHz19URs69p

Building from source

This project uses Zig build system, version 0.14.0.

For instructions, refer to the Zig build system documentation.

The build process depends on system libraries GMP, MPFR, MPC and Spiral (version 0.3.0).

To change the installation prefix (by default it's zig-out):

zig build --prefix ${PREFIX}

To generate and install man pages, Pandoc is required:

zig build man

License

This is a free software released under the GNU General Public License 3.0.

This software is provided as is, with no warranty.

Author

lch361 (a. k. a. Lich)

Like this project? Follow my other work at https://lch361.net!