-
Notifications
You must be signed in to change notification settings - Fork 232
Conversion from&to float<->integer #147
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
…n based on llvm algorithms.
the check! macro syntax has changed
Can close #106 also once this is merged. We could probably use a macro to impl the Float trait just like the Int trait, but that can be done in a followup PR. |
I can reproduce the powerpc segfault (inside QEMU) locally and consistently. It could be a QEMU bug as I have had segfaults like this with QEMUlated powerpc targets before; though, those were spurious. |
FWIW, I can repro the segfault with Cross, which uses QEMU 2.7.1. The CI here is using QEMU 2.6.1. Interestingly, I don' see the segfault if I run the test suite in release mode. Also given the error message
This could be a problem with the default cpu / architecture-level that QEMU uses. Perhaps, we just have to pick a different cpu model in QEMU. |
Does the architecture need to be changed here or in cross? |
@oli-obk Here, this repo doesn't use Cross. I tried a few different |
rust-lang/rust#41080 appears to have fixed the powerpc segfault (according to my local test). I'll retry once a new nightly becomes available. |
Nightly's out. Let's try this. @bors r+ |
📌 Commit 4c556dc has been approved by |
💔 Test failed - status-travis |
Getting undefined symbols now |
I think that was a cache problem as I can't repro locally and AppVeyor passed plus I think I have seen this kind of error beofer. I have cleared the caches. Let's try again. @bors retry |
💔 Test failed - status-travis |
It seems that we indeed are getting the wrong answer on powerpc64le. use std::mem;
fn main() {
let x: u32 = 9223372000000000000;
let y: f32 = unsafe { mem::transmute(x) };
let z = y as i64;
println!("f32: {}", y);
println!("i64: {}", z);
}
But it seems that the intrinsics we are currently shipping with today's
I'm not sure what's going on there. |
Oh, wait. That value doesn't fit in the |
to avoid imprecision due to rounding to f32
@bors r+ |
📌 Commit 109c33e has been approved by |
Cancelling Travis builds that won't be used by bors. |
☀️ Test successful - status-appveyor, status-travis |
this is a rebased version of #139
cc @ithinuel