Skip to content

Cross v0.1.15 Breaks f64 Modulus on i686 #314

@Alexhuszagh

Description

@Alexhuszagh

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

  1. Create a repository (cargo new --bin sample).
  2. Copy the failing code into main.rs.
  3. Run the binary on i686 (cross run --target i686-unknown-linux-gnu).

Finally, this code works with cargo run --target i686-unknown-linux-gnu.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-qemuArea: qemu runnersA-x86Area: x86 targetsbug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions