Skip to content

Commit ecd3c9c

Browse files
committed
Auto merge of #898 - christianpoveda:master, r=RalfJung
Use ldexp from cmath instead Closes #821 r? @RalfJung
2 parents b09ae31 + e1d1cd1 commit ecd3c9c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/shims/foreign_items.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -594,8 +594,10 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
594594
// FIXME: Using host floats.
595595
let x = f64::from_bits(this.read_scalar(args[0])?.to_u64()?);
596596
let exp = this.read_scalar(args[1])?.to_i32()?;
597-
// FIXME: We should use cmath if there are any imprecisions.
598-
let n = x * 2.0f64.powi(exp);
597+
extern {
598+
fn ldexp(x: f64, n: i32) -> f64;
599+
}
600+
let n = unsafe { ldexp(x, exp) };
599601
this.write_scalar(Scalar::from_u64(n.to_bits()), dest)?;
600602
}
601603

0 commit comments

Comments
 (0)