JuliaArrays / OffsetArrays.jl

Fortran-like arrays with arbitrary, zero or negative starting indices.
Other
198 stars 40 forks source link

Fix overflow in `searchsorted*` #286

Closed jishnub closed 2 years ago

jishnub commented 2 years ago

Fixes #285, but this doesn't fix all issues (as certain tests are broken). However, I think searchsortedfirst and searchsortedlast should be fixed.

codecov[bot] commented 2 years ago

Codecov Report

Merging #286 (b73570d) into master (d8c8d42) will decrease coverage by 0.36%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #286      +/-   ##
==========================================
- Coverage   95.90%   95.53%   -0.37%     
==========================================
  Files           5        5              
  Lines         464      426      -38     
==========================================
- Hits          445      407      -38     
  Misses         19       19              
Impacted Files Coverage Δ
src/OffsetArrays.jl 97.47% <100.00%> (-0.31%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d8c8d42...b73570d. Read the comment docs.

johnnychen94 commented 2 years ago

Hmmm, the failure on 1.0 is concerning. Do you know why that happens?

jishnub commented 2 years ago

Yes, should be fixed now. I had made a mistake in the test, but since empty ranges are equal in 1.6+, the test had passed.

jishnub commented 2 years ago

I feel like we're unnecessarily complicating matters here. We should simply pass the searchsorted to the parent, and add the offset. I've tried this locally and this resolves all issues.

jishnub commented 2 years ago

I think the codecov changes are ok, looks good to merge