-
-
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
Fix BigInt to Float conversions #10139
Conversation
|
||
## checks if last bit is 0 or 1: used for IEEE rounding | ||
is_ieee_even(x::Float64) = reinterpret(UInt64,x) & 1 == 0 | ||
is_ieee_even(x::Float32) = reinterpret(UInt32,x) & 1 == 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.
Maybe write these as is_ieee_even(x::Float64) = iseven(reinterpret(UInt64,x))
?
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.
I have a slightly better solution.
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.
Yes, generic reinterpret is much better!
91a0886
to
2330356
Compare
2330356
to
ea50176
Compare
I'm not sure what's causing the appveyor breakage. |
https://ci.appveyor.com/project/StefanKarpinski/julia/build/1.0.3095/job/8abr5wkvv2exgyla looks a little scarier than the usual case of #10045, but I just built this branch (only one time for now) locally on win32 without seeing it. I'll restart the appveyor build. |
ea50176
to
055f251
Compare
Bump. Any thoughts? cc: @StefanKarpinski |
Seems like a good thing to fix. Is there some potential downside? Otherwise just do it. |
It will require some intermediate allocation of |
055f251
to
930f875
Compare
Fix BigInt to Float conversions
Fixes #6365