-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add some tests for mixed-IEEEFloat calls, since I think there may be some ambiguity errors there:
julia> range(0.0f0, step=1.0e0, length=10)
0.0:1.0:9.0
julia> typeof(ans)
StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}
julia> range(0.0e0, step=1.0f0, length=10)
0.0f0:1.0f0:9.0f0
julia> typeof(ans)
StepRangeLen{Float32, Float64, Float64, Int64}
Now ambiguities should be resolved, unless I missed something. I added a bunch of different tests to check this. TwicePrecision is also now limited to real-valued ranges, so that e.g. complex ranges work correctly again. For now all of this is done by defining several variants of |
Fixes the return type of `range(start::IEEEFloat; step, length)` when `step` is *not* an `IEEEFloat` (e.g. when it's an integer).
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
- check complex ranges - check for ambiguities
3453ec2
to
fdd1296
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! Thank you
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
(cherry picked from commit 45ab664)
Follow-up of #44313. See also discussion in #43059.
Fixes the return type of:
range(start::IEEEFloat; step::Real, length)
range(; stop::IEEEFloat, step::Real, length)
range(; stop::Real, step::IEEEFloat, length)
making sure that
TwicePrecision
is always used in these cases.