File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -394,7 +394,7 @@ The default is the true midpoint at `α = 0.5`.
394
394
395
395
Assumes 0 ≤ α ≤ 1.
396
396
397
- Warning: if the parameter `α = 0.5` is explicitely set, the behavior differs
397
+ Warning: if the parameter `α = 0.5` is explicitly set, the behavior differs
398
398
from the default case if the provided `Interval` is not finite, since when
399
399
`α` is provided `mid` simply replaces `+∞` (respectively `-∞`) by `prevfloat(+∞)`
400
400
(respecively `nextfloat(-∞)`) for the computation of the intermediate point.
@@ -406,13 +406,15 @@ function mid(a::Interval{T}, α) where T
406
406
lo = (a. lo == - ∞ ? nextfloat (- ∞) : a. lo)
407
407
hi = (a. hi == + ∞ ? prevfloat (+ ∞) : a. hi)
408
408
409
- midpoint = α * (hi - lo) + lo
409
+ β = convert (T, α)
410
+
411
+ midpoint = β * (hi - lo) + lo
410
412
isfinite (midpoint) && return midpoint
411
413
#= Fallback in case of overflow: hi - lo == +∞.
412
414
This case can not be the default one as it does not pass several
413
415
IEEE1788-2015 tests for small floats.
414
416
=#
415
- return (1 - α ) * lo + α * hi
417
+ return (1 - β ) * lo + β * hi
416
418
end
417
419
418
420
"""
You can’t perform that action at this time.
0 commit comments