5 releases
0.1.4 | Mar 30, 2022 |
---|---|
0.1.3 | Mar 28, 2022 |
0.1.2 | Mar 28, 2022 |
0.1.1 | Mar 27, 2022 |
0.1.0 | Mar 27, 2022 |
#105 in #calculator
Used in 2 crates
37KB
1K
SLoC
clc-engine
Calculator
calculate given expression.
Core functionality for clc.
Examples
use clc_engine::Calculator;
let clc = Calculator::new();
let eval = clc.calculate_line("sqrt(sqrt(16)) * (4 + 2)");
assert_eq!(eval, Ok(12.));
Division by zero
use clc_engine::{Calculator, Error,EvalError};
let clc = Calculator::new();
let err = clc.calculate_line("10 / 0");
assert_eq!(err, Err(Error::Eval(EvalError::DivisionByZero)));
Under the hood clc-engine use nom to parse expression
License
This project is available under the terms of either the Apache 2.0 license or the MIT license.
Dependencies
~1MB
~22K SLoC