Skip to content

Commit

Permalink
Fix coverage (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
ararslan authored Dec 1, 2017
1 parent 032a924 commit a4e6dbc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/KahanSummation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ else
end
end

if isdefined(Base, :promote_sys_size_add)
using Base: promote_sys_size_add
else
promote_sys_size_add(x::T) where {T} = Base.r_promote(+, zero(T)::T)
end

"""
cumsum_kbn(A, dim::Integer)
Expand Down Expand Up @@ -87,7 +93,7 @@ summation algorithm for additional accuracy.
"""
function sum_kbn(A)
T = @default_eltype(typeof(A))
c = Base.promote_sys_size_add(zero(T)::T)
c = promote_sys_size_add(zero(T)::T)
i = start(A)
if done(A, i)
return c
Expand Down
3 changes: 3 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ using KahanSummation
using Compat
using Compat.Test

# Shadow the names in Base if they're defined
import KahanSummation: sum_kbn, cumsum_kbn

@testset "cumsum_kbn" begin
v = [1,1e100,1,-1e100]*1000
v2 = [1,-1e100,1,1e100]*1000
Expand Down

0 comments on commit a4e6dbc

Please sign in to comment.