-
-
Couldn't load subscription status.
- Fork 5.7k
fix overflow in prevfloat with unsigned stepcount
#59668
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
Conversation
9d8c140 to
3ce0e4f
Compare
|
I think the docs could stand an update, as applying a function instead of
it should probably be something more like
but I don't want to change the docs in this PR as that would likely invite stricter scrutiny |
|
This change could break |
|
I guess you may want to use the new |
those packages were already broken as the existing fallback is incorrect |
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.
LGTM
|
This caused e.g. the following package to error: Out of an abundance of caution I will drop this from 1.12 backport. It can be put back after analysis or if it gets fixed. |
|
that seems to be due to this definition without a corresponding |
| applications of [`nextfloat`](@ref) if `n < 0`. | ||
| """ | ||
| prevfloat(x::AbstractFloat, d::Integer) = nextfloat(x, -d) | ||
| prevfloat(x::AbstractFloat, d::Integer) = _nextfloat(x, ispositive(d), uabs(d)) |
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.
Now packages defining custom AbstractFloat are expected to define a method for Base._nextfloat?
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.
no, they should define prevfloat separately and explicitly as the old fallback in Base was not correct, leading to behavior like
julia> prevfloat(Measurement{Float64}(1.0), 0x01)
1.0000000000000566 ± 0.0
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.
fixes #59661