Skip to content

Commit 85056fd

Browse files
committed
fix: adjust NaN when rounding floats
1 parent c24e404 commit 85056fd

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

compiler/rustc_const_eval/src/interpret/intrinsics.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,6 +1009,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
10091009
{
10101010
let x: F = self.read_scalar(&args[0])?.to_float()?;
10111011
let res = x.round_to_integral(mode).value;
1012+
let res = self.adjust_nan(res, &[x]);
10121013
self.write_scalar(res, dest)?;
10131014
interp_ok(())
10141015
}

0 commit comments

Comments
 (0)