Skip to content

Commit d72b52b

Browse files
authored
Merge pull request #52 from jishnub/to_index
to_index for RealInfinity
2 parents eb0e5bb + 6171be4 commit d72b52b

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Infinities"
22
uuid = "e1ba4f0e-776d-440f-acd9-e1d2e9742647"
33
authors = ["Sheehan Olver <[email protected]>"]
4-
version = "0.1.8"
4+
version = "0.1.9"
55

66
[compat]
77
Aqua = "0.8"

src/Infinities.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ angle(x::RealInfinity) = π*signbit(x)
6868
string(y::RealInfinity) = signbit(y) ? "-∞" : "+∞"
6969
show(io::IO, y::RealInfinity) = print(io, string(y))
7070

71+
Base.to_index(i::RealInfinity) = convert(Integer, i)
72+
7173
#######
7274
# ComplexInfinity
7375
#######

test/runtests.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ using Aqua
203203
@test convert(Float16, -∞) Float16(-∞) -Inf16
204204
@test convert(BigFloat, -∞)::BigFloat == BigFloat(-∞)::BigFloat == -BigFloat(Inf)
205205
end
206+
207+
@test Base.to_index(RealInfinity()) ℵ₀
206208
end
207209

208210
@testset "ComplexInfinity" begin

0 commit comments

Comments
 (0)