This commit is contained in:
Wesley Wiser 2023-07-18 16:16:01 -04:00
parent 15e9f56088
commit 6f5d960389

View File

@ -914,16 +914,6 @@ fn emulate_foreign_item_by_name(
let x = this.read_scalar(x)?.to_f64()?;
let exp = this.read_scalar(exp)?.to_i32()?;
// Saturating cast to i16. Even those are outside the valid exponent range so
// `scalbn` below will do its over/underflow handling.
let exp = if exp > i32::from(i16::MAX) {
i16::MAX
} else if exp < i32::from(i16::MIN) {
i16::MIN
} else {
exp.try_into().unwrap()
};
let res = x.scalbn(exp);
this.write_scalar(Scalar::from_f64(res), dest)?;
}