Skip to content

Commit

Permalink
Add comment explaining why div() doesn't need widening logic
Browse files Browse the repository at this point in the history
  • Loading branch information
NHDaly authored Dec 5, 2018
1 parent dceec29 commit becc3df
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/FixedPointDecimals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ for remfn in [:rem, :mod, :mod1, :min, :max]
@eval $remfn(x::T, y::T) where {T <: FD} = reinterpret(T, $remfn(x.i, y.i))
end
for divfn in [:div, :fld, :fld1]
# div(x.i, y.i) eliminates the scaling coefficient, so we call the FD constructor.
# We don't need any widening logic, since we won't be multiplying by the coefficient.
@eval $divfn(x::T, y::T) where {T <: FD} = T($divfn(x.i, y.i))
end

Expand Down

0 comments on commit becc3df

Please sign in to comment.