From e1d1cd191f6601b0ed2219beb7a4fb00f25b6667 Mon Sep 17 00:00:00 2001 From: Christian Poveda Date: Thu, 8 Aug 2019 15:22:34 -0500 Subject: [PATCH] Use ldexp from cmath instead --- src/shims/foreign_items.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/shims/foreign_items.rs b/src/shims/foreign_items.rs index 37e5fe42c3d..ba9b7ca27eb 100644 --- a/src/shims/foreign_items.rs +++ b/src/shims/foreign_items.rs @@ -594,8 +594,10 @@ fn emulate_foreign_item( // 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)?; }