Open hanusek opened 2 years ago
Hello! I have two problems with expressions.
ez_eval()
@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);
Sorry, I've never used this crate and it hasn't changed in about two years. You might want to look for an alternative, or you could look into the implementation and see what it's doing for boolean and bit ops.
Hello! I have two problems with expressions.
ez_eval()
returns an incorrect value. The correct value is 2.@lnicola @likebike Can you help me?