Skip to content

Cast from f64 to f32 not working with latest nightly on Windows #13429

Closed
@Overv

Description

@Overv

I'm compiling the following program with the latest nightly binary for Windows (with gcc 4.7.2):

fn main() {
    let a = 3.14;
    let b = a as f32;
    println!("{:?}", b);
}

This prints 126443840048f32 instead of 3.14f32.

If I change the code to the following, it does work as expected:

fn main() {
    let a = 3.14;
    let b: f32 = a;
    println!("{:?}", b);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.P-mediumMedium priority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions