Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix indexing for InfStepRange #102

Merged
merged 1 commit into from
Oct 17, 2022

Conversation

jishnub
Copy link
Member

@jishnub jishnub commented Oct 17, 2022

This works around a 0 * Inf multiplication while indexing an InfStepRange.
Currently, on master,

julia> v = InfiniteArrays.InfStepRange(InfiniteCardinal{0}(), InfiniteCardinal{0}())
ℵ₀:ℵ₀:+∞

julia> v[1]
ERROR: ArgumentError: 0 is non-positive
Stacktrace:
 [1] *
   @ ~/.julia/packages/Infinities/Y1fpA/src/cardinality.jl:121 [inlined]
 [2] getindex(v::InfiniteArrays.InfStepRange{InfiniteCardinal{0}, InfiniteCardinal{0}}, i::Int64)
   @ InfiniteArrays ~/Dropbox/JuliaPackages/InfiniteArrays.jl/src/infrange.jl:202
 [3] top-level scope
   @ REPL[33]:1

After this PR

julia> v[1]
ℵ₀

@codecov
Copy link

codecov bot commented Oct 17, 2022

Codecov Report

Merging #102 (f067f6a) into master (5a4acbf) will increase coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #102      +/-   ##
==========================================
+ Coverage   85.01%   85.03%   +0.02%     
==========================================
  Files           4        4              
  Lines         654      655       +1     
==========================================
+ Hits          556      557       +1     
  Misses         98       98              
Impacted Files Coverage Δ
src/infrange.jl 87.82% <100.00%> (+0.04%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@dlfivefifty dlfivefifty merged commit 0873436 into JuliaArrays:master Oct 17, 2022
@jishnub jishnub deleted the infsteprangeindexing branch October 17, 2022 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants