diff --git a/Project.toml b/Project.toml index 2219a90..c6dd2c8 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Infinities" uuid = "e1ba4f0e-776d-440f-acd9-e1d2e9742647" authors = ["Sheehan Olver "] -version = "0.1.8" +version = "0.1.9" [compat] Aqua = "0.8" diff --git a/src/Infinities.jl b/src/Infinities.jl index 3bd8cd7..e6ff365 100644 --- a/src/Infinities.jl +++ b/src/Infinities.jl @@ -243,7 +243,7 @@ max(::RealInfinity, ::Infinity) = ∞ min(::Infinity, x::RealInfinity) = x max(::Infinity, x::RealInfinity) = ∞ - +Base.to_index(i::RealInfinity) = convert(Integer, i) ###### # ComplexInfinity diff --git a/test/runtests.jl b/test/runtests.jl index 8768545..695317f 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -205,6 +205,8 @@ end @test convert(Float16, -∞) ≡ Float16(-∞) ≡ -Inf16 @test convert(BigFloat, -∞)::BigFloat == BigFloat(-∞)::BigFloat == -BigFloat(Inf) end + + @test Base.to_index(RealInfinity()) ≡ ℵ₀ end @testset "ComplexInfinity" begin