Skip to content

Commit

Permalink
apply random float error to other float operations
Browse files Browse the repository at this point in the history
  • Loading branch information
LorrensP-2158466 committed Jan 30, 2025
1 parent 9c72bdc commit c10fc90
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/shims/foreign_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,9 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
"tgammaf" => f_host.gamma(),
_ => bug!(),
};
let res = res.to_soft();
// Apply a relative error with a magnitude on the order of 2^-21 to simulate
// non-deterministic behaviour of floats
let res = math::apply_random_float_error(this, res.to_soft(), -21);
let res = this.adjust_nan(res, &[f]);
this.write_scalar(res, dest)?;
}
Expand Down

0 comments on commit c10fc90

Please sign in to comment.