From a120da49749294f8ae9fb5f58ead923f092f00a0 Mon Sep 17 00:00:00 2001 From: albertodemichelis Date: Tue, 12 Mar 2019 22:06:05 +0800 Subject: [PATCH] fixed 0.0 and -0.0 comparison --- squirrel/sqvm.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/squirrel/sqvm.cpp b/squirrel/sqvm.cpp index ecdcbb7..2da6bea 100644 --- a/squirrel/sqvm.cpp +++ b/squirrel/sqvm.cpp @@ -641,8 +641,14 @@ bool SQVM::CLASS_OP(SQObjectPtr &target,SQInteger baseclass,SQInteger attributes bool SQVM::IsEqual(const SQObjectPtr &o1,const SQObjectPtr &o2,bool &res) { - if(sq_type(o1) == sq_type(o2)) { - res = (_rawval(o1) == _rawval(o2)); + SQObjectType t1 = sq_type(o1), t2 = sq_type(o2); + if(t1 == t2) { + if (t1 == OT_FLOAT) { + res = (_float(o1) == _float(o2)); + } + else { + res = (_rawval(o1) == _rawval(o2)); + } } else { if(sq_isnumeric(o1) && sq_isnumeric(o2)) {