github.com/adoxography/calcium
master / published Oct 21, 2019 / repository
calcium
calcium implements a basic command line calculator.
Installation
- Ensure that crystal is installed on your system.
- Clone the repository.
- To compile the binary, run
makefrom the project root. It will be compiled tobin/calcium.
Usage
The calcium executable accepts a single equation (as a string) as an argument.
Without precompiling
crystal src/cli.cr '1+1'
With precompiling
bin/calcium '1+1'
Capabilities
- Basic arithmetic operators (
+,-,*,/) - Complex expressions (Parentheses, order of operations)
- Unary negation
- Factorial (
!) - Exponentiation (
^) - Functions (
sin,cos,tan,abs,min,max)
Testing
crystal spec tests the crystal library. spec/test.sh all tests the command line interface.
Contributors
- adoxography - creator and maintainer
API
- Calcium
- Float
Float is the base type of all floating point numbers.
- NegativeFactorialError
- NonIntegerFactorialError