Skip to content
Snippets Groups Projects
Commit 42b9f3a7 authored by Russel Arbore's avatar Russel Arbore
Browse files

;(

parent 682cbcac
No related branches found
No related tags found
1 merge request!170Fix float constants in LLVM
Pipeline #201608 passed
......@@ -265,8 +265,8 @@ impl<'a> CPUContext<'a> {
Constant::UnsignedInteger32(val) => write!(body, "i32 {} to i32\n", val)?,
Constant::UnsignedInteger64(val) => write!(body, "i64 {} to i64\n", val)?,
Constant::Float32(val) => {
write!(body, "float 0x{:08x}00000000 to float\n", unsafe {
transmute::<f32, u32>(*val)
write!(body, "float 0x{:016x} to float\n", unsafe {
transmute::<f64, u64>(*val as f64)
})?;
}
Constant::Float64(val) => {
......
#[entry]
fn casts_and_intrinsics(input : f32) -> i32 {
let sqrt = sqrt!::<f32>(input);
let sqrt = sqrt!::<f32>(input + 0.3);
return sqrt as i32;
}
......@@ -7,7 +7,7 @@ juno_build::juno!("casts_and_intrinsics");
fn main() {
async_std::task::block_on(async {
let mut r = runner!(casts_and_intrinsics);
let output = r.run(16.0).await;
let output = r.run(15.7).await;
println!("{}", output);
assert_eq!(output, 4);
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment