Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Wilson authored Dec 14, 2018
1 parent 61e3427 commit 5b7c357
Showing 1 changed file with 40 additions and 41 deletions.
81 changes: 40 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,24 @@

RSC is also designed with the goal to not become bloated software. **RSC will not receive frequent updates, but that does not mean it is old or unmaintained.** That being said, RSC may still receive internal updates with relation to speed or resource usage.

The abbreviation can be interpreted in two majorly different ways:
* Rust Scientific Calculations library
* Rust Scientific Calculator

# Obtaining RSC
If you would like to install RSC as a program onto your computer, you can either build the package or download it from the releases. More information [here](https://github.com/asmoaesl/rsc/wiki/Executable).
If you would like to install RSC as a program onto your computer, there is information [here](https://github.com/asmoaesl/rsc/wiki/Executable).

# Size
RSC is ~350 lines of code. Executable RSC is about 387KiB debug; 266KiB release (on Windows).
RSC is ~500 lines of Rust code.

# Performance
RSC computes next to instantaneously, even with debug builds. The following output is the time (in nanoseconds) the different operations take to process `sqrt((6.1--2.22)^2 + (-24-10.5)^2)`, where "bench_eval" is all of them at once. More info at [lib.rs](https://github.com/asmoaesl/rsc/blob/master/src/lib.rs).
```rs
PS C:\Users\Luke\Documents\Projects\rsc\target\release> cargo bench
Finished release [optimized] target(s) in 0.01s
Running deps\rsc-d36a195311b11bb0.exe
PS C:\Users\Luke\Documents\Projects\rsc> cargo bench
Finished release [optimized] target(s) in 0.02s
Running target\release\deps\rsc-74a7d2c06ab98eee.exe

running 4 tests
test tests::bench_compute ... bench: 174 ns/iter (+/- 30)
test tests::bench_eval ... bench: 5,678 ns/iter (+/- 300)
test tests::bench_parse ... bench: 1,480 ns/iter (+/- 149)
test tests::bench_tokenize ... bench: 3,774 ns/iter (+/- 352)
test tests::bench_compute ... bench: 231 ns/iter (+/- 10)
test tests::bench_eval ... bench: 6,272 ns/iter (+/- 504)
test tests::bench_parse ... bench: 1,624 ns/iter (+/- 133)
test tests::bench_tokenize ... bench: 4,302 ns/iter (+/- 1,462)
...
```

Expand All @@ -35,44 +31,43 @@ RSC is MIT licensed. RSC will always remain free to modify and use without attri

# Example
```
PS C:\Users\lukew> rsc
>2+3*4
14
>2+3(4)
14
>(3)(4)
12
>sqrt 4
2
>sqrt(4)
PS C:\Users\Luke> rsc
>2+2
4
>a = 2
2
>sqrt 4 + 2
>a^3
8
>b
Compute error: UnrecognizedIdentifier("b")
>(b = a^2) + 3
7
>b
4
>sin(6.5/9.7)
0.6210667900937665
>sin cos tan 2
-0.5449592372801408
>sqrt((6.1--2.22)^2 + (-24-10.5)^2)
35.48904619738322
>|-3|
3
>abs -3
3
```
## Debug
RSC can be run with the `ast` flag and show the internal expression that was created by the parser. This is most commonly used for entertainment purposes 😛.
```
PS C:\Users\lukew> rsc ast
>pi*2^2
BinOp(
Star,
Constant(
3.141592653589793
),
Pow(
Constant(
2.0
),
PS C:\Users\Luke> rsc ast
>(a = 2)^3
Pow(
Assignment(
"a",
Constant(
2.0
)
),
Constant(
3.0
)
)
12.566370614359172
8
```
## Errors
```
Expand All @@ -85,6 +80,10 @@ Lexer error: InvalidNumber("3.3.1")
Parser error: ExpectedFactor(None)
>2(3
Parser error: ExpectedClosingParenthesis
>2b
Parser error: UnexpectedNumber(Identifier("b"))
>b
Compute error: UnrecognizedIdentifier("b")
```
# Related Projects
* [rscplot](https://github.com/asmoaesl/rscplot)
* [rscplot](https://github.com/asmoaesl/rscplot): A graphing calculator dependent on RSC for solving expressions.

0 comments on commit 5b7c357

Please sign in to comment.