Skip to content

Commit

Permalink
Fix type-promotion in BigInt transforms (#244)
Browse files Browse the repository at this point in the history
  • Loading branch information
jishnub authored Apr 28, 2024
1 parent b2cd0e8 commit 9c379b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/chebyshevtransform.jl
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ ichebyshevutransform(x, dims...; kwds...) = plan_ichebyshevutransform(x, dims...
## Code generation for integer inputs

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


Expand Down Expand Up @@ -742,4 +742,4 @@ for pln in (:plan_chebyshevtransform!, :plan_chebyshevtransform,
$pln(x::AbstractArray, dims...; kws...) = $pln(x, Val(1), dims...; kws...)
$pln(::Type{T}, szs, dims...; kwds...) where T = $pln(Array{T}(undef, szs...), dims...; kwds...)
end
end
end
4 changes: 4 additions & 0 deletions test/chebyshevtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,10 @@ using FastTransforms, Test
@test plan_chebyshevtransform!(x)copy(x) chebyshevtransform(x)
@test plan_ichebyshevtransform!(x)copy(x) ichebyshevtransform(x)
end
@testset "BigInt" begin
x = big(10)^400 .+ BigInt[1,2,3]
@test ichebyshevtransform(chebyshevtransform(x)) x
end

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

0 comments on commit 9c379b9

Please sign in to comment.