mirror of
https://github.com/shopspring/decimal.git
synced 2024-11-22 04:20:50 +01:00
Fix overflow edge case in QuoRem method (#322)
This commit is contained in:
parent
142a0cf2f2
commit
b844c58a71
1 changed files with 1 additions and 1 deletions
|
@ -561,7 +561,7 @@ func (d Decimal) QuoRem(d2 Decimal, precision int32) (Decimal, Decimal) {
|
||||||
panic("decimal division by 0")
|
panic("decimal division by 0")
|
||||||
}
|
}
|
||||||
scale := -precision
|
scale := -precision
|
||||||
e := int64(d.exp - d2.exp - scale)
|
e := int64(d.exp) - int64(d2.exp) - int64(scale)
|
||||||
if e > math.MaxInt32 || e < math.MinInt32 {
|
if e > math.MaxInt32 || e < math.MinInt32 {
|
||||||
panic("overflow in decimal QuoRem")
|
panic("overflow in decimal QuoRem")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue