- Zig 100%
| demo | Moved demos to their own folder | |
| doc | Fixed some typos in a readme | |
| man | Implemented user-defined functions. | |
| src | Updated pop() usage for newer master versions | |
| .gitignore | Removed old build system | |
| build.zig | Noticed and fixed some version format bugs | |
| examples.md | Moved demos to their own folder | |
| LICENSE | Implemented full documentation inside of a program. | |
| README.md | Implemented full documentation inside of a program. | |
lcalc
A command–Line Calculator.
Features
- GUI–free calculation of mathematical expressions.
- Integer (
4), rational (7/3), floating (2.3) and complex (2 + 3i) numbers. - Binary, (
+,*,/, ...), unary (-, ...) operators. - Variables:
x = 5. - Predefined constants:
piorπ,e, and more. - Predefined functions:
max(1, 2),sin(pi), .... - User–defined functions:
csc(x) = 1/sin(x) - Intuitive syntax, close to a math notation, but unambiguous:
3x (2sin(z) / 4y) - Numbers in different bases: hex (
0xFF), bin (0b10110), oct (0o777). - Modern, but simple interface with syntax highlighting and themes.
- Documentation inside of a command–line:
help, for specific operations —help +.
See examples for a visual showcase.
Downloading
The releases page has archives of a precompiled executable for different operating systems. These also include the documentation.
Every archive is signed via minisign with the following public key:
RWTW/iadZl5EZQtwd5E0HKfXXzjq6ePMGtKhz5VAPm7VLJHz19URs69p
Running
Once you've downloaded a desired archive,
unpack it and run the file bin/lcalc inside.
Here is an example for Linux systems, let ./lcalc-1.0.0-x86_64-linux-gnu.tar.xz be the
downloaded archive:
mkdir lcalc
cd lcalc
tar -xf ../lcalc-1.0.0-x86_64-linux-gnu.tar.xz
bin/lcalc
If the program fails to launch, check if you have GMP, MPFR, MPC libraries installed.
The executable can be used as standalone, but it won't be able to find its documentation if placed outside of the unpacked archive.
Installing
If you have an FHS–compliant system (in other words, Linux), you can install it to the standard prefix for the programs.
An example script to be run as root:
cd /usr/local
tar -xf ~/lcalc-1.0.0-x86_64-linux-gnu.tar.xz
Now, if the /usr/local/bin directory is in your PATH,
you can enjoy running lcalc with all features and documentation.
Building from source
This project is written in Zig, with latest compiler version
in mind: 0.14.0-dev.2557+f06ca14cb.
git clone https://codeberg.org/lch361/lcalc
cd lcalc
zig build -Doptimize=ReleaseFast # Or ReleaseSmall for different optimization
cd zig-out
bin/lcalc
To install to a different prefix, for example, /usr/local:
zig build --prefix /usr/local
To generate and install the man pages, you'll need Pandoc:
zig build man
Author
Made by me, lch361. See more about me and my projects at https://lch361.net.
License
This is a free software released under the GNU General Public License 3.0.
Copy of this license is available in this repository as LICENSE.txt file,
and gets shipped with every release archive.
This software is provided as is, with no warranty.