-
Notifications
You must be signed in to change notification settings - Fork 41
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 integerish conversions #757
Fix integerish conversions #757
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.
Lgtm.
Personally, I didn't like the way it was done before.
We should strive for a performant conversion, if you ask me, but that's another discussion altogether.
I believe if the num crate does this in a more clever way, we ought to consider it.
Bytemuck does not do conversions. I checked. It merely reinterprets bytes.
Please consider this https://doc.rust-lang.org/std/primitive.f64.html#method.to_int_unchecked |
It practically does what Since I extracted the logic as much as I could, if we find a better solution to map an |
Fixes #720.
f64
(Rfloat
) to integer type conversions (bothFromRobj
andTryFrom
) by extracting all logic into a singleFloatToInt
trait.NA
, over-/under-flow, subnormality4.2f64
no longer maps to4i32
)f64
values that are exactly representable by target integer typeAlso update
xtask
:cargo extendr devtools-test
now gained-f
/--filter
option that controls which tests to execute. Value is passed verbatim tofilter
parameter ofdevtools::test()