2 stable releases
1.0.1 | Jun 21, 2021 |
---|---|
1.0.0 | Jun 12, 2021 |
#228 in Parser tooling
11KB
204 lines
Calculator
A lightweight rust calculation parser. Only supports basic syntax, eg. no parentheses or functions beyond basic operators.
The current operators that are supported are
Character used | Function |
---|---|
+ |
Add to number |
- |
Subtract from number |
* |
Multiply number |
\ |
Divide number |
^ |
Use an exponent |
Example: 2^2+5
would be transformed into 9. It is pretty much just normal math syntax.
Just pass a string reference to the calculate
function, and a 64 bit floating point number will be returned.