Merge pull request #276 from nushell/epsilon

Fix some machine epsilon warnings
This commit is contained in:
JT 2021-11-02 19:53:12 +13:00 committed by GitHub
commit 8368b52ac7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -141,7 +141,7 @@ mod tests {
match (&lhs.expr, &rhs.expr) { match (&lhs.expr, &rhs.expr) {
(Expr::Bool(a), Expr::Bool(b)) => assert_eq!(a, b), (Expr::Bool(a), Expr::Bool(b)) => assert_eq!(a, b),
(Expr::Int(a), Expr::Int(b)) => assert_eq!(a, b), (Expr::Int(a), Expr::Int(b)) => assert_eq!(a, b),
(Expr::Float(a), Expr::Float(b)) => assert_eq!(a, b), (Expr::Float(a), Expr::Float(b)) => assert!((a - b).abs() < f64::EPSILON),
(Expr::String(a), Expr::String(b)) => assert_eq!(a, b), (Expr::String(a), Expr::String(b)) => assert_eq!(a, b),
_ => panic!("not matching values"), _ => panic!("not matching values"),
} }

View File

@ -228,7 +228,7 @@ mod tests {
match (&lhs.expr, &rhs.expr) { match (&lhs.expr, &rhs.expr) {
(Expr::Bool(a), Expr::Bool(b)) => assert_eq!(a, b), (Expr::Bool(a), Expr::Bool(b)) => assert_eq!(a, b),
(Expr::Int(a), Expr::Int(b)) => assert_eq!(a, b), (Expr::Int(a), Expr::Int(b)) => assert_eq!(a, b),
(Expr::Float(a), Expr::Float(b)) => assert_eq!(a, b), (Expr::Float(a), Expr::Float(b)) => assert!((a - b).abs() < f64::EPSILON),
(Expr::String(a), Expr::String(b)) => assert_eq!(a, b), (Expr::String(a), Expr::String(b)) => assert_eq!(a, b),
_ => panic!("not matching values"), _ => panic!("not matching values"),
} }