From 4c038b053bca91819be77a52565b9594a1c30963 Mon Sep 17 00:00:00 2001 From: Sheehan Olver Date: Thu, 9 Sep 2021 10:18:02 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20ambiguity=20in=20=E2=84=B5=E2=82=80=20?= =?UTF-8?q?=E2=89=A4=C2=A0RealInfinity()=20(#16)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Project.toml | 2 +- src/cardinality.jl | 2 ++ test/test_cardinality.jl | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index cf21bab..026c56c 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.1" +version = "0.1.2" [compat] julia = "1" diff --git a/src/cardinality.jl b/src/cardinality.jl index 6b87b67..62463bc 100644 --- a/src/cardinality.jl +++ b/src/cardinality.jl @@ -82,6 +82,8 @@ isless(x::InfiniteCardinal, y::AbstractFloat) = false <(::InfiniteCardinal, x::Real) = false ≤(::InfiniteCardinal{0}, x::Real) = ∞ ≤ x ≤(::InfiniteCardinal, x::Real) = false +≤(::InfiniteCardinal{0}, x::RealInfinity) = ∞ ≤ x +≤(::InfiniteCardinal, x::RealInfinity) = false >(::InfiniteCardinal{0}, y::Real) = ∞ > y >(::InfiniteCardinal, ::Real) = true ≥(::InfiniteCardinal, ::Real) = true diff --git a/test/test_cardinality.jl b/test/test_cardinality.jl index f0379c7..690530a 100644 --- a/test/test_cardinality.jl +++ b/test/test_cardinality.jl @@ -56,6 +56,9 @@ using Infinities, Base64, Base.Checked, Test @test !(-∞ > ℵ₀) && !(-∞ ≥ ℵ₀) @test ℵ₀ > -∞ @test ℵ₁ > -∞ && ℵ₁ ≥ -∞ + @test ℵ₀ ≤ RealInfinity() + @test !(ℵ₀ ≤ -∞) + @test !(ℵ₁ ≤ RealInfinity()) @test Inf < ℵ₁ && !(ℵ₁ < Inf) @test !(Inf < ℵ₀) && !(ℵ₀ < Inf)