We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8249279 commit 3da9474Copy full SHA for 3da9474
src/FindFirstFunctions.jl
@@ -238,12 +238,14 @@ function (g::Guesser)(x)
238
f > 0 ? lastindex(v) : firstindex(v)
239
else
240
i_0, i_f = firstindex(v), lastindex(v)
241
- i_appr = f * (i_f - i_0) + i_0
242
- target_type = typeof(firstindex(v))
243
- if typemin(target_type) <= i_appr <= typemax(target_type)
244
- round(target_type, i_appr)
+ i_approx = f * (i_f - i_0) + i_0
+ target_type = eltype(v)
+ if i_approx <= typemin(target_type)
+ firstindex(v) - 1
245
+ elseif i >= typemax(target_type)
246
+ lastindex(v) + 1
247
- idx_prev[]
248
+ round(target_type, i_appr)
249
end
250
251
0 commit comments