Skip to content

Commit ecece4e

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 6976457 + e45f98e commit ecece4e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/FixedPointDecimals.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ function Base.Checked.mul_with_overflow(x::FD{T,f}, y::FD{T,f}) where {T<:Intege
430430
powt = coefficient(FD{T, f})
431431
quotient, remainder = fldmodinline(_widemul(x.i, y.i), powt)
432432
v = _round_to_nearest(quotient, remainder, powt)
433-
return (reinterpret(FD{T,f}, Base.trunc_int(T, v)), v < typemin(T) || v > typemax(T))
433+
return (reinterpret(FD{T,f}, rem(v, T)), v < typemin(T) || v > typemax(T))
434434
end
435435

436436
# This does not exist in Base so is just part of this package.
@@ -444,7 +444,7 @@ overflow/underflow did in fact happen. Throws a DivideError on divide-by-zero.
444444
"""
445445
function div_with_overflow(x::FD{T,f}, y::FD{T,f}) where {T<:Integer,f}
446446
C = coefficient(FD{T, f})
447-
# This case will break the fld call below.
447+
# This case will break the div call below.
448448
if y.i == -1 && T <: Signed && hasmethod(typemin, (Type{T},)) && x.i == typemin(T)
449449
# To perform the div and overflow means reaching the max and adding 1, so typemin.
450450
return (x, true)

0 commit comments

Comments
 (0)