fix issue 252 (#858)

This commit is contained in:
wangzelin19961202 2022-08-08 20:35:53 +08:00 committed by GitHub
parent a69e1e30df
commit da3b184eb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 {