-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Description
Hello!
I have two problems with expressions.
- Library did not recognize booleans.
- The function -
ez_eval()returns an incorrect value.
The correct value is 2.
@lnicola @likebike Can you help me?
use fasteval::{EmptyNamespace, ez_eval};
let mut ns = EmptyNamespace;
// OK
let value = ez_eval("1 == 1", &mut ns).unwrap();
println!("1 == 1 -> fast_eval: {:?}", value);
assert_eq!(value, 1.0);
// 1.
// PROBLEM
let value = ez_eval("true == true", &mut ns).unwrap();
println!("true == true -> fast_eval: {:?}", value);
assert_eq!(value, 1.0);
// 2.
// PROBLEM, result = 3 ??
let bitand_text = format!("{} && {}", b_value, b_mask);
let value = ez_eval(bitand_text.as_str(), &mut ns).unwrap();
println!("bitand_text {} -> fast_eval: {:?}", bitand_text, value);
assert_eq!(value, 2.0);Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels