JuliaMath / FixedPointNumbers.jl

fixed point types for julia

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Removing the obsolete promotions for reductions

kimikage opened this issue · comments

The current codebase has no compatibility with Julia v0.6, because the syntax for parametric methods has been fully changed to the current (i.e.where) style. I think the backporting is not easy. Therefore, the following codes are no longer useful.

if isdefined(Base, :r_promote)
# Julia v0.6
Base.r_promote(::typeof(+), x::FixedPoint{T}) where {T} = Treduce(x)
Base.r_promote(::typeof(*), x::FixedPoint{T}) where {T} = Treduce(x)
Base.reducedim_init(f::typeof(identity),
op::typeof(+),
A::AbstractArray{T}, region) where {T <: FixedPoint} =
Base.reducedim_initarray(A, region, zero(Treduce))
Base.reducedim_init(f::typeof(identity),
op::typeof(*),
A::AbstractArray{T}, region) where {T <: FixedPoint} =
Base.reducedim_initarray(A, region, oneunit(Treduce))
else

Removing the obsolete promotions may help improve the promotion rules. For example, the current promotions use const Treduce = Float64, but I don't think it is always pretty good. (I can expect the negative impact of the braking change to be significant, though.)
Moreover, it ostensibly improves the code coverage.