Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/NalinPlad/rustcalc
Browse files Browse the repository at this point in the history
  • Loading branch information
NalinPlad committed Jun 3, 2022
2 parents cda8dae + 7c0f9a1 commit 684f0ab
Showing 1 changed file with 78 additions and 0 deletions.
78 changes: 78 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,81 @@ Lots of additions to a basic `lalrpop` calculator parser including:
* Ans variable, holds the answer to the previous operation 📝

And many more quality of life features

---

### Docs 📖

Ill add some basic documentation of some of plus's functionality here. Most people wont even need to read this to user plus, it is very straight forward!

#### Basic operations

plus's syntax is very similar to anything you would enter into a normal calculator(apart from a few special cases), so equtions like
```
plus> 5+5
10
plus> 13*3
39
plus> (16/4)^3
64
```

all work as intended. Note here that the parser will ignore whitespace, so you could also type `plus> ( 16 /4) ^ 3`

#### Variables

Define variables with `=`

```
plus> x = 32
32
plus> y = 45/9
5
plus> z = x / y
6.4
```

then use it like this

```
plus> 3y / 2
7.5
plus> 5 * z
32
plus> 5(z)
32
plus> 5z
32
```

multiplication syntax is pretty robust, as seen in the last 3 lines

#### Trig functions

plus (currently) includes 6 trig functions, sin(), cos(), tan(), and csc(), sec(), cot(). It also defines the constant `pi`.

```
plus> sin(2pi)
0
plus> cos(32)
0.8342233605
plus> tan(180)
1.3386902104
plus> pi
3.1415926536
```

#### Roots

plus has a couple roots functions for calculating square and cube roots. Arbitrary roots are planned(See [TODO](https://github.com/NalinPlad/plus/blob/master/TODO)) Both `` and `sqrt()` can be used

```
plus> √25
5
plus> sqrt(100)
10
plus> (3)√125
5
plus> cbrt(1000)
10
```

0 comments on commit 684f0ab

Please sign in to comment.