Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
wjhuang2016 authored and SunRunAway committed Jul 22, 2019
1 parent 7db2a1d commit b1ba5c5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions expression/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2765,6 +2765,7 @@ func (s *testIntegrationSuite) TestArithmeticBuiltin(c *C) {
tk.MustExec("INSERT IGNORE INTO t VALUE(12 MOD 0);")
tk.MustQuery("show warnings;").Check(testkit.Rows("Warning 1365 Division by 0"))
tk.MustQuery("select v from t;").Check(testkit.Rows("<nil>"))
tk.MustQuery("select 0.000 % 0.11234500000000000000;").Check(testkit.Rows("0.00000000000000000000"))

_, err = tk.Exec("INSERT INTO t VALUE(12 MOD 0);")
c.Assert(terror.ErrorEqual(err, expression.ErrDivisionByZero), IsTrue)
Expand Down
2 changes: 2 additions & 0 deletions types/mydecimal.go
Original file line number Diff line number Diff line change
Expand Up @@ -1982,7 +1982,9 @@ func doDivMod(from1, from2, to, mod *MyDecimal, fracIncr int) error {
}
if prec1 <= 0 {
/* short-circuit everything: from1 == 0 */
resultFrac := to.resultFrac
*to = zeroMyDecimal
to.resultFrac = resultFrac
return nil
}
prec1 -= countLeadingZeroes((prec1-1)%digitsPerWord, from1.wordBuf[idx1])
Expand Down

0 comments on commit b1ba5c5

Please sign in to comment.