-
Notifications
You must be signed in to change notification settings - Fork 14
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
Implement u128/i128 support #13
Conversation
r? @japaric Also please don't forget to publish a new version (0.2.1?). |
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.
Thanks for the PR, @est31. This looks good to me except for the "lossless" u128 -> f32 conversion. I'd prefer to skip that for now. Would that be good enough for the compiler-builtins PR?
.travis.yml
Outdated
@@ -9,13 +9,13 @@ env: TARGET=x86_64-unknown-linux-gnu | |||
matrix: | |||
include: | |||
- env: TARGET=i686-unknown-linux-gnu | |||
- env: TARGET=x86_64-unknown-linux-gnu | |||
- env: TARGET=x86_64-unknown-linux-gnu RUST_BETA=1 |
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.
nit: the TRAVIS_RUST_VERSION variable will contain the string 'beta' or 'nightly' when 'rust: beta' or 'rust: nightly' is used here. You can use that var instead of defining a new one.
src/lib.rs
Outdated
u32 => i128, u128; | ||
u64 => i128, u128; | ||
usize => i128, u128; | ||
u128 => f32, f64, u128; |
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'm not sure if u128 -> f32 can be really be considered a promotion.
f32::MAX
prints 340282350000000000000000000000000000000
.
u128::MAX
prints 340282366920938463463374607431768211455
So u128::MAX
is larger than f32::MAX
or IOW u128::MAX
doesn't fit in f32
. IMO, this conversion should return Error::Overflow. However, rustc (and gcc) seem to be fine with the u128::MAX as f32
operation; it returns inf
. That seems wrong to me -- that's not loss of precision; that's a rounding operation with a rounding error of inf
.
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've modified it to make it pass now.
The review should be addressed now. |
Thanks @est31. @homunkulus r+ |
📌 Commit ca5aaef has been approved by |
☀️ Test successful - status-travis |
Fixes #12
Unfortunately only commented out tests, due to BurntSushi/quickcheck#162