Skip to content

Commit fc0bdc4

Browse files
committed
Expose algebraic floating point intrinsics
1 parent 2eb95ca commit fc0bdc4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/intrinsics/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,9 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
411411
};
412412
let res = this.binary_op(op, &a, &b)?;
413413
// `binary_op` already called `generate_nan` if needed.
414-
// Apply a relative error of 16ULP to simulate non-deterministic precision loss
414+
// Apply a relative error of 4ULP to simulate non-deterministic precision loss
415415
// due to optimizations.
416-
let res = apply_random_float_error_to_imm(this, res, 4 /* log2(16) */)?;
416+
let res = apply_random_float_error_to_imm(this, res, 2 /* log2(4) */)?;
417417
this.write_immediate(*res, dest)?;
418418
}
419419

@@ -464,9 +464,9 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
464464
if !float_finite(&res)? {
465465
throw_ub_format!("`{intrinsic_name}` intrinsic produced non-finite value as result");
466466
}
467-
// Apply a relative error of 16ULP to simulate non-deterministic precision loss
467+
// Apply a relative error of 4ULP to simulate non-deterministic precision loss
468468
// due to optimizations.
469-
let res = apply_random_float_error_to_imm(this, res, 4 /* log2(16) */)?;
469+
let res = apply_random_float_error_to_imm(this, res, 2 /* log2(4) */)?;
470470
this.write_immediate(*res, dest)?;
471471
}
472472

0 commit comments

Comments
 (0)