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

range uses TwicePrecision when possible (part 2) #44528

Merged
merged 12 commits into from
Mar 11, 2022
Prev Previous commit
Next Next commit
Make sure non-Real ranges work correctly
  • Loading branch information
jipolanco committed Mar 10, 2022
commit 3f544ca8c8d8aa58a713f5e0312ad5f9dc5ce45f
6 changes: 3 additions & 3 deletions base/twiceprecision.jl
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ end
step(r::StepRangeLen{T,TwicePrecision{T},TwicePrecision{T}}) where {T<:AbstractFloat} = T(r.step)
step(r::StepRangeLen{T,TwicePrecision{T},TwicePrecision{T}}) where {T} = T(r.step)

range_start_step_length(a, st::IEEEFloat, len::Integer) =
range_start_step_length(a::Real, st::IEEEFloat, len::Integer) =
range_start_step_length(oftype(st, a), st, len)
jipolanco marked this conversation as resolved.
Show resolved Hide resolved

range_start_step_length(a::IEEEFloat, st::Real, len::Integer) =
Expand All @@ -480,10 +480,10 @@ function range_start_step_length(a::T, st::T, len::Integer) where T<:IEEEFloat
steprangelen_hp(T, a, st, 0, len, 1)
end

range_step_stop_length(step, stop::IEEEFloat, len::Integer) =
range_step_stop_length(step::Real, stop::IEEEFloat, len::Integer) =
range_step_stop_length(oftype(stop, step), stop, len)
jipolanco marked this conversation as resolved.
Show resolved Hide resolved

range_step_stop_length(step::IEEEFloat, stop, len::Integer) =
range_step_stop_length(step::IEEEFloat, stop::Real, len::Integer) =
range_step_stop_length(step, oftype(step, stop), len)
jipolanco marked this conversation as resolved.
Show resolved Hide resolved

function range_step_stop_length(step::IEEEFloat, stop::IEEEFloat, len::Integer)
Expand Down