Skip to content

Commit 06f9fc6

Browse files
authored
Generalize eltype pass-through to all AbstractFloat (fixes #308) (#317)
1 parent 9a62714 commit 06f9fc6

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/b-splines/b-splines.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ end
147147

148148
# We can't just return a tuple-of-types due to julia #12500
149149
tweight(A::AbstractArray) = Float64
150-
tweight(A::AbstractArray{Float32}) = Float32
150+
tweight(A::AbstractArray{T}) where T<:AbstractFloat = T
151151
tweight(A::AbstractArray{Rational{Int}}) = Rational{Int}
152152
tweight(A::AbstractArray{T}) where {T<:Integer} = typeof(float(zero(T)))
153153

test/b-splines/runtests.jl

+2
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@
66
include("mixed.jl")
77
include("multivalued.jl")
88
include("non1.jl")
9+
10+
@test eltype(@inferred(interpolate(rand(Float16, 3, 3), BSpline(Linear())))) == Float16 # issue #308
911
end

0 commit comments

Comments
 (0)