Skip to content

Commit a4e6dbc

Browse files
authored
Fix coverage (#2)
1 parent 032a924 commit a4e6dbc

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/KahanSummation.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ else
2323
end
2424
end
2525

26+
if isdefined(Base, :promote_sys_size_add)
27+
using Base: promote_sys_size_add
28+
else
29+
promote_sys_size_add(x::T) where {T} = Base.r_promote(+, zero(T)::T)
30+
end
31+
2632
"""
2733
cumsum_kbn(A, dim::Integer)
2834
@@ -87,7 +93,7 @@ summation algorithm for additional accuracy.
8793
"""
8894
function sum_kbn(A)
8995
T = @default_eltype(typeof(A))
90-
c = Base.promote_sys_size_add(zero(T)::T)
96+
c = promote_sys_size_add(zero(T)::T)
9197
i = start(A)
9298
if done(A, i)
9399
return c

test/runtests.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ using KahanSummation
55
using Compat
66
using Compat.Test
77

8+
# Shadow the names in Base if they're defined
9+
import KahanSummation: sum_kbn, cumsum_kbn
10+
811
@testset "cumsum_kbn" begin
912
v = [1,1e100,1,-1e100]*1000
1013
v2 = [1,-1e100,1,1e100]*1000

0 commit comments

Comments
 (0)