@@ -10,7 +10,7 @@ import Base: ==, <, <=, -, +, *, /, ~, isapprox,
1010 zero, oneunit, one, typemin, typemax, realmin, realmax, eps, sizeof, reinterpret,
1111 float, trunc, round, floor, ceil, bswap,
1212 div, fld, rem, mod, mod1, fld1, min, max, minmax,
13- start, next, done, reducedim_init, rand
13+ start, next, done, rand
1414if isdefined (Base, :rem1 )
1515 import Base: rem1
1616end
@@ -134,20 +134,27 @@ sizeof(::Type{T}) where {T <: FixedPoint} = sizeof(rawtype(T))
134134# Promotions for reductions
135135const Treduce = Float64
136136if isdefined (Base, :r_promote )
137+ # Julia v0.6
137138 Base. r_promote (:: typeof (+ ), x:: FixedPoint{T} ) where {T} = Treduce (x)
138139 Base. r_promote (:: typeof (* ), x:: FixedPoint{T} ) where {T} = Treduce (x)
140+ Base. reducedim_init (f:: typeof (identity),
141+ op:: typeof (+ ),
142+ A:: AbstractArray{T} , region) where {T <: FixedPoint } =
143+ Base. reducedim_initarray (A, region, zero (Treduce))
144+ Base. reducedim_init (f:: typeof (identity),
145+ op:: typeof (* ),
146+ A:: AbstractArray{T} , region) where {T <: FixedPoint } =
147+ Base. reducedim_initarray (A, region, oneunit (Treduce))
139148else
140- Base. promote_sys_size (:: Type{<:FixedPoint} ) = Treduce
149+ # Julia v0.7
150+ Base. add_sum (x:: FixedPoint , y:: FixedPoint ) = Treduce (x) + Treduce (y)
151+ Base. reduce_empty (:: typeof (Base. add_sum), :: Type{F} ) where {F<: FixedPoint } = zero (Treduce)
152+ Base. reduce_first (:: typeof (Base. add_sum), x:: FixedPoint ) = Treduce (x)
153+ Base. mul_prod (x:: FixedPoint , y:: FixedPoint ) = Treduce (x) * Treduce (y)
154+ Base. reduce_empty (:: typeof (Base. mul_prod), :: Type{F} ) where {F<: FixedPoint } = one (Treduce)
155+ Base. reduce_first (:: typeof (Base. mul_prod), x:: FixedPoint ) = Treduce (x)
141156end
142157
143- reducedim_init (f:: typeof (identity),
144- op:: typeof (+ ),
145- A:: AbstractArray{T} , region) where {T <: FixedPoint } =
146- reducedim_initarray (A, region, zero (Treduce))
147- reducedim_init (f:: typeof (identity),
148- op:: typeof (* ),
149- A:: AbstractArray{T} , region) where {T <: FixedPoint } =
150- reducedim_initarray (A, region, oneunit (Treduce))
151158
152159for f in (:div , :fld , :fld1 )
153160 @eval begin
0 commit comments