Skip to content

Commit

Permalink
Auto merge of #898 - christianpoveda:master, r=RalfJung
Browse files Browse the repository at this point in the history
Use ldexp from cmath instead

Closes #821
r? @RalfJung
  • Loading branch information
bors committed Aug 8, 2019
2 parents b09ae31 + e1d1cd1 commit ecd3c9c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/shims/foreign_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -594,8 +594,10 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
// FIXME: Using host floats.
let x = f64::from_bits(this.read_scalar(args[0])?.to_u64()?);
let exp = this.read_scalar(args[1])?.to_i32()?;
// FIXME: We should use cmath if there are any imprecisions.
let n = x * 2.0f64.powi(exp);
extern {
fn ldexp(x: f64, n: i32) -> f64;
}
let n = unsafe { ldexp(x, exp) };
this.write_scalar(Scalar::from_u64(n.to_bits()), dest)?;
}

Expand Down

0 comments on commit ecd3c9c

Please sign in to comment.