From da3b184eb8681445c0b772231227a2f99ff379aa Mon Sep 17 00:00:00 2001 From: wangzelin19961202 <84574399+wangzelin19961202@users.noreply.github.com> Date: Mon, 8 Aug 2022 20:35:53 +0800 Subject: [PATCH] fix issue 252 (#858) --- src/sql/engine/expr/ob_expr_mod.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sql/engine/expr/ob_expr_mod.cpp b/src/sql/engine/expr/ob_expr_mod.cpp index cd536e38a8..2f3cd1f7e0 100644 --- a/src/sql/engine/expr/ob_expr_mod.cpp +++ b/src/sql/engine/expr/ob_expr_mod.cpp @@ -22,6 +22,8 @@ namespace oceanbase { using namespace common; namespace sql { +constexpr double EPSILON = 0.000000001; + ObExprMod::ObExprMod(ObIAllocator& alloc) : ObArithExprOperator(alloc, T_OP_MOD, N_MOD, 2, NOT_ROW_DIMENSION, ObExprResultTypeUtil::get_mod_result_type, ObExprResultTypeUtil::get_mod_calc_type, mod_funcs_) @@ -400,7 +402,7 @@ int ObExprMod::mod_double(const ObExpr& expr, ObEvalCtx& ctx, ObDatum& datum) } else { const double left_d = left->get_double(); const double right_d = right->get_double(); - if (fabs(right_d) == 0.0) { + if (fabs(right_d) < EPSILON) { if (lib::is_oracle_mode()) { datum.set_double(left_d); } else { -- GitLab