https://github.com/bitwalker/rustcalc
A tiny command line calculator built in Rust for a code challenge
https://github.com/bitwalker/rustcalc
Last synced: about 1 year ago
JSON representation
A tiny command line calculator built in Rust for a code challenge
- Host: GitHub
- URL: https://github.com/bitwalker/rustcalc
- Owner: bitwalker
- License: mit
- Created: 2015-07-14T19:17:57.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2015-07-16T02:12:49.000Z (almost 11 years ago)
- Last Synced: 2025-02-15T08:20:49.331Z (about 1 year ago)
- Language: Rust
- Size: 383 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## rustcalc
A tiny command line calculator built in Rust for a code challenge.
It supports `+`, `-`, `/`, `*`, and `^` operators, as well as the
usage of `-` as negation. Grouping with `()` is also allowed. Numbers
can either be integers or arbitrary-precision floats.
## Example
```bash
$ ./bin/rustcalc
Welcome to rustcalc!
To quit, just type `exit` and press ENTER.
Type an expression and press ENTER to evaluate: 3.5+(2-1)*(10^2)/2
Result: 3.5+(2-1)*(10^2)/2 == 53.5
Type an expression and press ENTER to evaluate: exit
$
```
## Usage (from binary)
1. Download `bin/rustcalc` or `bin/rustcalc.exe`
2. From the command line: `./rustcalc` or `.\rustcalc.exe`
## Usage (from source)
1. Install Rust (nightly is required for some feature flags in use)
2. Clone rustcalc repository
3. From the command line: `cd rustcalc && cargo run`
## Benchmarks
1. Install Rust (nightly)
2. Clone rustcalc repository
3. From the command line: `cd rustcalc && cargo bench`