From e58efcebe20bf34f7181ce04303ddbbfed2a8024 Mon Sep 17 00:00:00 2001 From: Nathanne Isip Date: Wed, 9 Oct 2024 11:19:51 +0800 Subject: [PATCH] Fixed binary expression value for epsilon on double value comparison operation. --- src/ast/expression/BinaryExpression.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ast/expression/BinaryExpression.cpp b/src/ast/expression/BinaryExpression.cpp index f919428..1425a43 100644 --- a/src/ast/expression/BinaryExpression.cpp +++ b/src/ast/expression/BinaryExpression.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -113,9 +114,11 @@ DynamicObject BinaryExpression::applyNumOp(DynamicObject& lValue, DynamicObject& else if(this->op == "<=") return DynamicObject(lValue.getNumber() <= rValue.getNumber()); else if(this->op == "==") - return DynamicObject(std::fabs(lValue.getNumber() - rValue.getNumber()) < __DBL_EPSILON__); + return DynamicObject(std::fabs(lValue.getNumber() - rValue.getNumber()) < + std::numeric_limits::epsilon()); else if(this->op == "!=") - return DynamicObject(std::fabs(lValue.getNumber() - rValue.getNumber()) >= __DBL_EPSILON__); + return DynamicObject(std::fabs(lValue.getNumber() - rValue.getNumber()) >= + std::numeric_limits::epsilon()); else if(this->op == "<<") return DynamicObject((float) ((unsigned long) lValue.getNumber() << (unsigned long) rValue.getNumber())); else if(this->op == ">>")