Skip to content

Commit

Permalink
Fixed problematic type inference when exponentiating KVector{K} whe…
Browse files Browse the repository at this point in the history
…n `K` is odd
  • Loading branch information
brainandforce committed Feb 28, 2024
1 parent 908d84a commit 5d0bcac
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/math.jl
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ end
sandwich(x::BaseNumber, ::CliffordNumber) = x

#---Exponentials-----------------------------------------------------------------------------------#
import Base: exp
import Base: exp, ^

"""
CliffordNumbers.intlog2(x::Real) -> Int
Expand Down Expand Up @@ -529,6 +529,10 @@ end

exponential_type(x::AbstractCliffordNumber) = exponential_type(typeof(x))

# KVector{K} promotes incorrectly for odd k due to broken type inference, see this issue:
# https://github.com/JuliaLang/julia/issues/53504
^(k::KVector, n::Integer) = convert(exponential_type(k), k)^n

"""
CliffordNumbers.exp_taylor(x::AbstractCliffordNumber, order = 12)
Expand Down

0 comments on commit 5d0bcac

Please sign in to comment.