Open
Description
opened on Oct 1, 2024
using Test
@testset "`^(::AbstractIrrational, ::Integer)`" begin
@testset "c: $c" for c ∈ (ℯ, π, MathConstants.γ, MathConstants.φ, MathConstants.catalan)
let e = -1
@test c ≈ (c^e)^e
end
end
end
Test Summary: | Pass Error Total Time
`^(::AbstractIrrational, ::Integer)` | 1 4 5 1.6s
c: ℯ | 1 1 0.0s
c: π | 1 1 1.2s
c: γ | 1 1 0.1s
c: φ | 1 1 0.1s
c: catalan | 1 1 0.1s
ERROR: Some tests did not pass: 1 passed, 0 failed, 4 errored, 0 broken.
Among the Irrational
constants, only ℯ
works as a base for exponentiation here, I guess because that case gets forwarded to exp
.
I guess the fix is to define a method something like the following:
^(c::AbstractIrrational, n::Integer) = AbstractFloat(c) ^ n
Activity