Crates.io | calc_engine |
lib.rs | calc_engine |
version | 0.4.1 |
source | src |
created_at | 2021-05-07 14:55:43.88254 |
updated_at | 2021-05-25 20:02:50.757305 |
description | An engine / tool that performs calculations. |
homepage | |
repository | https://github.com/tevs-rust-land/rust-calc |
max_upload_size | |
id | 394275 |
size | 19,729 |
This Engine transforms a string representation of a Math expression to the actual result of the expression.
I'm using the top-down recursive descent parsing techque. (Input is read from Left -> Right)
use calc_engine;
func main() {
let res = calc_engine::calculate("1 + 1")?;
let error_margin = f64::EPSILON;
assert!((result - 2.0).abs() < error_margin);
let res = calc_engine::calculate("(1 + 1) + 3")?;
}
Not in any particular order.