Minimally promoting division

Note that you can also define an infix operator by appending a subscript, e.g. /ᵣ.

This doesn’t seem crazy to me. It would ideally have to be done in Base to avoid type piracy.

You could alternatively define:

newtondivdiff(x::AbstractVector{<:Integer}, y::AbstractVector{<:Integer}) =
    newtondivdiff(Rational.(x), Rational.(y))

and then just use / (which is exact for rationals or mixtures of rationals and integers).

1 Like