aboutsummaryrefslogtreecommitdiff
path: root/readme.md
blob: a1c7d17be24c5fdf1eb1a6cf2e8e9c5ffefcfbf2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
![heroimg.png](https://files.nerdypepper.me/6G.png)

# eva

simple calculator REPL, similar to `bc(1)`, with syntax highlighting and persistent history

![eva.png](https://files.nerdypepper.me/kP.png)

### installation

- crates.io
```shell
$ cargo install eva
```

- manual
```shell
$ git clone https://github.com/nerdypepper/eva.git
$ cargo run
```

### usage

```shell
eva 0.2.4
NerdyPepper <[email protected]>
Calculator REPL similar to bc(1)

USAGE:
    eva [FLAGS] [OPTIONS] [INPUT]

FLAGS:
    -h, --help       Prints help information
    -r, --radian     set eva to radian mode
    -V, --version    Prints version information

OPTIONS:
    -b, --base <RADIX>    set the radix of calculation output (2, 8, 10, 16 etc.)
    -f, --fix <FIX>       set number of decimal places in the output

ARGS:
    <INPUT>    optional expression string to run eva in command mode

```

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 avaliable in rust standard library.

```
e      pi
```

examples:
```
pi * 5^2  # πr²
```

### functions

all trignometric functions expect input in degrees.

```
sin    cos     tan    csc    sec    cot    sinh   cosh   tanh
asin   acos    atan   acsc   asec   acot   ln     log    sqrt
ceil   floor   abs

deg(x) - convert x to degrees
rad(x) - convert x to radians
```

examples:
```
sqrt(sin(30)) # parentheses are mandatory for functions

log100        # no
log(100)      # yes
```

### 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
```

- 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)