Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/oppiliappan/eva
a calculator REPL, similar to bc(1)
https://github.com/oppiliappan/eva
calculator cli hacktoberfest rust
Last synced: 12 days ago
JSON representation
a calculator REPL, similar to bc(1)
- Host: GitHub
- URL: https://github.com/oppiliappan/eva
- Owner: oppiliappan
- License: mit
- Created: 2019-03-16T16:38:07.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-01-15T03:51:57.000Z (10 months ago)
- Last Synced: 2024-08-06T16:10:45.007Z (3 months ago)
- Topics: calculator, cli, hacktoberfest, rust
- Language: Rust
- Homepage:
- Size: 182 KB
- Stars: 815
- Watchers: 5
- Forks: 29
- Open Issues: 13
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
![heroimg.png](https://u.peppe.rs/6G.png)
# eva
simple calculator REPL, similar to `bc(1)`, with syntax highlighting and persistent history
![eva.png](https://u.peppe.rs/kP.png)
### installation
- Homebrew
```shell
$ brew install eva
```- crates.io
```shell
$ cargo install eva
```- manual
```shell
$ git clone https://github.com/nerdypepper/eva
$ cd eva
$ cargo run
```### usage
```shell
eva 0.3.1
NerdyPepper
Calculator REPL similar to bc(1)USAGE:
eva [OPTIONS] [INPUT]ARGS:
Optional expression string to run eva in command modeOPTIONS:
-b, --base Radix of calculation output (1 - 36) [default: 10]
-f, --fix Number of decimal places in output (1 - 64) [default: 10]
-h, --help Print help information
-r, --radian Use radian mode
-V, --version Print version information```
type out an expression and hit enter, repeat.
```shell
> 1 + sin(30)
1.5
> floor(sqrt(3^2 + 5^2))
5
> 5sin(45) + cos(0)
4.53553
```### updating
- crates.io
```shell
$ cargo install eva --force
```- manual
```shell
$ cargo install --force --path /path/to/eva
```### operators
- binary operators: `+ - * / ^ **`
- unary operators: `+ -`### constants
some constants available in rust standard library.
```
e pi
```examples:
```
pi * 5^2 # πr²
```### functions
all trigonometric functions expect input in degrees.
```
1 argument:
sin cos tan csc sec cot sinh cosh tanh
asin acos atan acsc asec acot ln log2 log10
sqrt ceil floor abs2 arguments:
log nrootdeg(x) - convert x to degrees
rad(x) - convert x to radians
```examples:
```
sqrt(sin(30)) # parentheses are mandatory for functionslog10100 # no
log10(100) # yeslog(1, 10) # function with two arguments
```### quality of life features
- auto insertion of `*` operator
```
>12sin(45(2)) # 12 * sin(45 * (2))
12
```- auto balancing of parentheses
```
>ceil(sqrt(3^2 + 5^2 # ceil(sqrt(3^2 + 5^2))
6
```- use previous answer with `_`
```
> sin(pi)
0.0548036650
> _^2
0.0030034417
>
```- super neat error handling
```
> 1 + ln(-1)
Domain Error: Out of bounds!
```- syntax highlighting
### todo
- ~~add support for variables (pi, e, _ (previous answer))~~
- ~~syntax highlighting~~
- ~~multiple arg functions~~
- ~~screenshots~~
- ~~create logo~~
- ~~unary operators (minus, plus)~~
- ~~add detailed error handler~~
- ~~add unit tests~~
- ~~lineditor~~ with syntax highlighting
- ~~add more functions~~### contributors
the rust community has helped eva come a long way, but these devs deserve a
special mention for their contributions:[Ivan Tham](https://github.com/pickfire)
[Milan Marković](https://github.com/hepek)
[asapokl](https://github.com/kzoper)