pub(crate) fn apply_random_float_error<F: Float>(
ecx: &mut MiriInterpCx<'_>,
val: F,
err_scale: i32,
) -> F
Expand description
Disturbes a floating-point result by a relative error in the range (-2^scale, 2^scale).
For a 2^N ULP error, you can use an err_scale
of -(F::PRECISION - 1 - N)
.
In other words, a 1 ULP (absolute) error is the same as a 2^-(F::PRECISION-1)
relative error.
(Subtracting 1 compensates for the integer bit.)