Skip to content

Commit

Permalink
ensure int keys in rulecache
Browse files Browse the repository at this point in the history
  • Loading branch information
stevengj committed Jul 25, 2023
1 parent 6a8dbe4 commit f1f776b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/gausskronrod.jl
Original file line number Diff line number Diff line change
Expand Up @@ -558,8 +558,8 @@ const rulecache = Dict{Type,Dict}(
const bigrulecache = Dict{Tuple{Int,Int}, NTuple{3,Vector{BigFloat}}}()

function cachedrule(::Union{Type{BigFloat},Type{Complex{BigFloat}}}, n::Integer)
key = (n, precision(BigFloat))
haskey(bigrulecache, key) ? bigrulecache[key] : (bigrulecache[key] = kronrod(BigFloat, n))
key = (Int(n), precision(BigFloat))
haskey(bigrulecache, key) ? bigrulecache[key] : (bigrulecache[key] = kronrod(BigFloat, Int(n)))
end

# use a generated function to make this type-stable
Expand Down

0 comments on commit f1f776b

Please sign in to comment.