-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Inconsistent behavior of Base.floatrange
#45336
Comments
wow. That is awful. |
I build the latest master with L395 commented. Test Summary: | Pass Error Broken Total Time
Overall | 12110865 1 327682 12438548 1m11.8s
ranges | 12110865 1 327682 12438548 1m10.3s
FAILURE
The global RNG seed was 0xd80800aebdb44d7a3931f2e34a3be386.
Error in testset ranges:
Error During Test at C:\Users\XXX\Documents\Github\julia\test\ranges.jl:877
Test threw exception
Expression: length(Base.floatrange(-3.0e9, 1.0, 1, 1.0)) == 1
MethodError: no method matching floatrange(::Float64, ::Float64, ::Int64, ::Float64)
Closest candidates are:
floatrange(::Type{T}, ::Integer, ::Integer, ::Integer, ::Integer) where T at twiceprecision.jl:381 So I think we should just remove it. |
https://github.com/search?l=Julia&p=1&q=Base.floatrange&type=Code After code search on GitHub, we can almost conclude that the only widely user of |
* Replace Base.floatrange with simplified implementation Base.floatrange has bugs and is not public API anymore See JuliaLang/julia#45336 Use a simplified implementation instead * Inline floatrange
Maybe we can remove it because StatsBase.jl does not depend on it anymore. |
@metab0t feel free to make a PR implementing it and we can PkgEval it |
@Moelf I have opened a PR to remove the inconsistent instance of |
When digging into a bug in
StatsBase.fit
:I find that the core issue happens in usage of
Base.floatrange
I try the following code:
In
twiceprecision.jl
,ref
in twosteprangelen_hp
definitions has different meanings.TwicePrecision{Float64}(ref)
TwicePrecision{Float64}(ref...)
(it should align with integer case)However,
TwicePrecision{Float64}(1.0, 1.0)
andTwicePrecision{Float64}((1.0, 1.0))
are totally different.Therefore, two
floatrange
definitions return different resultsjulia/base/twiceprecision.jl
Line 381 in 45ab664
julia/base/twiceprecision.jl
Line 395 in 45ab664
Code examples:
Version info:
The text was updated successfully, but these errors were encountered: