From 6a4566c223808df0a4a6728fc61f1f53bfc87f2e Mon Sep 17 00:00:00 2001 From: TudbuT Date: Mon, 18 Nov 2024 09:34:16 +0100 Subject: [PATCH] make equality less strange --- src/runtime.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/runtime.rs b/src/runtime.rs index 0fa00a8..b4f412f 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -1083,11 +1083,11 @@ impl Object { pub fn is_truthy(&self) -> bool { match &self.native { Value::Null => self.kind.lock_ro().id != 0, - Value::Int(x) => x > &0, - Value::Long(x) => x > &0, - Value::Mega(x) => x > &0, - Value::Float(_) => true, - Value::Double(_) => true, + Value::Int(x) => *x > 0, + Value::Long(x) => *x > 0, + Value::Mega(x) => *x > 0, + Value::Float(x) => x.is_finite(), + Value::Double(x) => x.is_finite(), Value::Func(_) => true, Value::Array(_) => true, Value::Str(x) => !x.is_empty(),