Skip to content

Commit

Permalink
add a note
Browse files Browse the repository at this point in the history
  • Loading branch information
putianyi889 committed Nov 8, 2024
1 parent 2b932e2 commit 5ca6995
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions src/cardinality.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,18 @@ Base.to_shape(dims::Tuple{Vararg{Union{Infinity, Integer, AbstractUnitRange}}})

Base.Checked.checked_sub(::Integer, ::InfiniteCardinal{0}) = -
Base.Checked.checked_sub(::InfiniteCardinal{0}, ::Integer) = ℵ₀
Base.Checked.checked_sub(::InfiniteCardinal{0}, ::InfiniteCardinal{0}) = NotANumber() # ambiguity fix
Base.Checked.checked_sub(::InfiniteCardinal{0}, ::InfiniteCardinal{0}) = NotANumber()
Base.Checked.checked_add(::Integer, ::InfiniteCardinal{0}) = ℵ₀
Base.Checked.checked_add(::InfiniteCardinal{0}, ::Integer) = ℵ₀
Base.Checked.checked_add(::InfiniteCardinal{0}, ::InfiniteCardinal{0}) = ℵ₀ # ambiguity fix

Base.Checked.checked_add(::InfiniteCardinal{0}, ::InfiniteCardinal{0}) = ℵ₀
Base.Checked.checked_mul(x::Integer, ::InfiniteCardinal{0}) = sign(x)*
Base.Checked.checked_mul(::InfiniteCardinal{0}, x::Integer) = sign(x)*
Base.Checked.checked_mul(::InfiniteCardinal{0}, ::InfiniteCardinal{0}) = ℵ₀ # ambiguity fix
Base.Checked.checked_mul(::InfiniteCardinal{0}, ::InfiniteCardinal{0}) = ℵ₀


##
# hash
##

Base.hash(::InfiniteCardinal{0}) = 0x775431eef01bca90 # made up
Base.hash(::InfiniteCardinal{1}) = 0x55437c69b794f8ce # made up

Expand Down
2 changes: 1 addition & 1 deletion src/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ iszero(::AllInfinities) = false
isinf(::AllInfinities) = true
isfinite(::AllInfinities) = false

promote_rule(::Type{Infinity}, ::Type{RealInfinity}) = RealInfinity
promote_rule(::Type{Infinity}, ::Type{RealInfinity}) = RealInfinity # not detected by CodeCov. Removing this results in failed tests.

Check warning on line 10 in src/interface.jl

View check run for this annotation

Codecov / codecov/patch

src/interface.jl#L10

Added line #L10 was not covered by tests
promote_rule(::Type{Infinity}, ::Type{ComplexInfinity{T}}) where T = ComplexInfinity{T}
promote_rule(::Type{RealInfinity}, ::Type{ComplexInfinity{T}}) where T = ComplexInfinity{T}
promote_rule(::Type{ComplexInfinity{T}}, ::Type{RealInfinity}) where T<:Integer = ComplexInfinity{T}
Expand Down

0 comments on commit 5ca6995

Please sign in to comment.