@@ -300,10 +300,17 @@ end
300300for remfn in [:rem , :mod , :mod1 , :min , :max ]
301301 @eval $ remfn (x:: T , y:: T ) where {T <: FD } = reinterpret (T, $ remfn (x. i, y. i))
302302end
303- for divfn in [:div , :fld , :fld1 ]
303+ # TODO : When we upgrade to a min julia version >=1.4 (i.e Julia 2.0), this block can be
304+ # dropped in favor of three-argument `div`, below.
305+ for divfn in [:div , :fld , :fld1 , :cld ]
304306 # div(x.i, y.i) eliminates the scaling coefficient, so we call the FD constructor.
305307 # We don't need any widening logic, since we won't be multiplying by the coefficient.
306- @eval $ divfn (x:: T , y:: T ) where {T <: FD } = T ($ divfn (x. i, y. i))
308+ @eval Base.$ divfn (x:: T , y:: T ) where {T <: FD } = T ($ divfn (x. i, y. i))
309+ end
310+ if VERSION >= v " 1.4.0-"
311+ # div(x.i, y.i) eliminates the scaling coefficient, so we call the FD constructor.
312+ # We don't need any widening logic, since we won't be multiplying by the coefficient.
313+ Base. div (x:: T , y:: T , r:: RoundingMode ) where {T <: FD } = T (div (x. i, y. i, r))
307314end
308315
309316convert (:: Type{AbstractFloat} , x:: FD ) = convert (floattype (typeof (x)), x)
0 commit comments