Skip to content

Commit 9c379b9

Browse files
authored
Fix type-promotion in BigInt transforms (#244)
1 parent b2cd0e8 commit 9c379b9

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/chebyshevtransform.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ ichebyshevutransform(x, dims...; kwds...) = plan_ichebyshevutransform(x, dims...
598598
## Code generation for integer inputs
599599

600600
for func in (:chebyshevtransform,:ichebyshevtransform,:chebyshevutransform,:ichebyshevutransform)
601-
@eval $func(x::AbstractVector{T}, dims...; kwds...) where {T<:Integer} = $func(convert(AbstractVector{Float64},x), dims...; kwds...)
601+
@eval $func(x::AbstractVector{T}, dims...; kwds...) where {T<:Integer} = $func(convert(AbstractVector{float(T)},x), dims...; kwds...)
602602
end
603603

604604

@@ -742,4 +742,4 @@ for pln in (:plan_chebyshevtransform!, :plan_chebyshevtransform,
742742
$pln(x::AbstractArray, dims...; kws...) = $pln(x, Val(1), dims...; kws...)
743743
$pln(::Type{T}, szs, dims...; kwds...) where T = $pln(Array{T}(undef, szs...), dims...; kwds...)
744744
end
745-
end
745+
end

test/chebyshevtests.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,10 @@ using FastTransforms, Test
443443
@test plan_chebyshevtransform!(x)copy(x) chebyshevtransform(x)
444444
@test plan_ichebyshevtransform!(x)copy(x) ichebyshevtransform(x)
445445
end
446+
@testset "BigInt" begin
447+
x = big(10)^400 .+ BigInt[1,2,3]
448+
@test ichebyshevtransform(chebyshevtransform(x)) x
449+
end
446450

447451
@testset "immutable vectors" begin
448452
F = plan_chebyshevtransform([1.,2,3])

0 commit comments

Comments
 (0)