@@ -529,8 +529,8 @@ fn random_nan<S: Semantics>(rng: &mut StdRng) -> IeeeFloat<S> {
529
529
///
530
530
/// For `powf*` operations of the form:
531
531
///
532
- /// - `x ^(±0)` where `x` is a SNaN
533
- /// - `1^y` where `y` is SNaN
532
+ /// - `(SNaN) ^(±0)`
533
+ /// - `1^( SNaN)`
534
534
///
535
535
/// The result is implementation-defined:
536
536
/// - musl returns for both `1.0`
@@ -565,13 +565,9 @@ fn fixed_float_value<S: Semantics>(
565
565
566
566
// x^(±0) = 1 for any x, even a NaN, *but* not a SNaN
567
567
( "powf32" | "powf64" , [ base, exp] ) if exp. is_zero ( ) => {
568
+ let rng = ecx. machine . rng . get_mut ( ) ;
568
569
// Handle both the musl and glibc cases non-deterministically.
569
- if base. is_signaling ( ) {
570
- let rng = ecx. machine . rng . get_mut ( ) ;
571
- if rng. random ( ) { one } else { random_nan ( rng) }
572
- } else {
573
- one
574
- }
570
+ if !base. is_signaling ( ) || rng. random ( ) { one } else { random_nan ( rng) }
575
571
}
576
572
577
573
// There are a lot of cases for fixed outputs according to the C Standard, but these are mainly INF or zero
@@ -582,7 +578,7 @@ fn fixed_float_value<S: Semantics>(
582
578
583
579
/// Returns `Some(output)` if `powi` (called `pown` in C) results in a fixed value specified in the C standard
584
580
/// (specifically, C23 annex F.10.4.6) when doing `base^exp`. Otherwise, returns `None`.
585
- // REVIEW : I'm not sure what I should document here about pown(1, SNaN) since musl and glibc do the same and the C standard is explicit here.
581
+ // TODO : I'm not sure what I should document here about pown(1, SNaN) since musl and glibc do the same and the C standard is explicit here.
586
582
fn fixed_powi_float_value < S : Semantics > (
587
583
ecx : & mut MiriInterpCx < ' _ > ,
588
584
base : IeeeFloat < S > ,
0 commit comments