Closed
Description
STR
#![feature(rustc_attrs)]
#[rustc_mir]
fn const_mir() -> f32 { 9007199791611905.0 }
fn const_old() -> f32 { 9007199791611905.0 }
fn main() {
let s = "9007199791611905.0"; // (1<<53)+(1<<29)+1
println!("old: {}", const_old());
println!("MIR: {}", const_mir());
println!("single rounding: {}", s.parse::<f32>().unwrap());
println!("double rounding: {}", s.parse::<f64>().unwrap() as f32);
}
Expected Result
Both MIR and old trans should use a single rounding, that's it
old: 9007200000000000
MIR: 9007200000000000
single rounding: 9007200000000000
double rounding: 9007199000000000
Actual Result
old trans is single-rounding as it should, but MIR is doing a double rounding:
old: 9007200000000000
MIR: 9007199000000000
single rounding: 9007200000000000
double rounding: 9007199000000000