Update ob_expr_remainder.cpp (#693)

resolve issue#618
This commit is contained in:
zhouhuahui 2021-12-14 15:16:28 +08:00 committed by GitHub
parent 11ba7bf233
commit 67b1a08ed1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -281,14 +281,14 @@ int ObExprRemainder::calc_remainder_expr(const ObExpr& expr, ObEvalCtx& ctx, ObD
}
}
} else if (ObFloatTC == tc) {
if (0 == right->get_float()) {
if ((right->get_float() < 1e-6 && right->get_float() >= 0.0) || (right->get_float() > -(1e-6) && right->get_float() <= 0.0)) {
ret = OB_ERR_DIVISOR_IS_ZERO;
LOG_WARN("divisor is equal to zero on oracle mode", K(ret), K(right->get_float()));
} else {
res.set_float(remainder(left->get_float(), right->get_float()));
}
} else if (ObDoubleTC == tc) {
if (0 == right->get_double()) {
if ((right->get_double() < 1e-15 && right->get_double() >= 0.0) || (right->get_double() > -(1e-15) && right->get_double() <= 0.0)) {
ret = OB_ERR_DIVISOR_IS_ZERO;
LOG_WARN("divisor is equal to zero on oracle mode", K(ret), K(right->get_double()));
} else {