Function fixed_float_value

Source
fn fixed_float_value<S: Semantics>(
    ecx: &mut MiriInterpCx<'_>,
    intrinsic_name: &str,
    args: &[IeeeFloat<S>],
) -> Option<IeeeFloat<S>>
Expand description

For the intrinsics:

  • sinf32, sinf64
  • cosf32, cosf64
  • expf32, expf64, exp2f32, exp2f64
  • logf32, logf64, log2f32, log2f64, log10f32, log10f64
  • powf32, powf64

§Return

Returns Some(output) if the intrinsic results in a defined fixed output specified in the C standard (specifically, C23 annex F.10) when given args as arguments. Outputs that are unaffected by a relative error (such as INF and zero) are not handled here, they are assumed to be handled by the underlying implementation. Returns None if no specific value is guaranteed.

§Note

For powf* operations of the form:

  • (SNaN)^(±0)
  • 1^(SNaN)

The result is implementation-defined:

  • musl returns for both 1.0
  • glibc returns for both NaN

This discrepancy exists because SNaN handling is not consistently defined across platforms, and the C standard leaves behavior for SNaNs unspecified.

Miri chooses to adhere to both implementations and returns either one of them non-deterministically.