-
Notifications
You must be signed in to change notification settings - Fork 422
Closed
Labels
Description
The following code worked for cross v0.1.14, so any issues were introduced with the latest release.
Targets
- i686-unknown-linux-gnu
x86_64 works fine, so the issue only occurs on 32-bit x86.
Failing Code
fn main() {
let value: f64 = 29860476080414620.0;
let base: f64 = 17.0;
println!("value % base = {:?}", value % base);
}
Results
value % base = -4.0
The value is negative for the float modulus, rather than 15.0
. Running with target x86_64-unknown-linux-gnu
prints the expected result (15.0
).
Minimal Steps to Reproduce
- Create a repository (
cargo new --bin sample
). - Copy the failing code into
main.rs
. - Run the binary on i686 (
cross run --target i686-unknown-linux-gnu
).
Finally, this code works with cargo run --target i686-unknown-linux-gnu
.