Allow floating point numbers ending in a period.

This commit is contained in:
Stephen Chung
2020-11-23 22:51:21 +08:00
parent 36aa827e15
commit 86009c70c8
3 changed files with 31 additions and 12 deletions

View File

@@ -15,6 +15,7 @@ fn test_float() -> Result<(), Box<EvalAltResult>> {
engine.eval::<bool>("let x = 0.0; let y = 1.0; x > y")?,
false
);
assert_eq!(engine.eval::<bool>("let x = 0.; let y = 1.; x > y")?, false);
assert!((engine.eval::<FLOAT>("let x = 9.9999; x")? - 9.9999 as FLOAT).abs() < EPSILON);
Ok(())