File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
src/libraries/System.Numerics.Tensors/tests Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -386,7 +386,17 @@ public static IEnumerable<object[]> SpanDestinationFunctionsToTest()
386386 yield return Create ( TensorPrimitives . Reciprocal , f => T . One / f ) ;
387387 yield return Create ( TensorPrimitives . ReciprocalEstimate , T . ReciprocalEstimate , T . CreateTruncating ( Helpers . DefaultToleranceForEstimates ) ) ;
388388 yield return Create ( TensorPrimitives . ReciprocalSqrt , f => T . One / T . Sqrt ( f ) ) ;
389- yield return Create ( TensorPrimitives . ReciprocalSqrtEstimate , T . ReciprocalSqrtEstimate , T . CreateTruncating ( Helpers . DefaultToleranceForEstimates ) ) ;
389+
390+ ReadOnlySpan < float > src = [ - float . Epsilon ] ;
391+ Span < float > dst = stackalloc float [ 1 ] ;
392+ TensorPrimitives . ReciprocalSqrtEstimate ( src , dst ) ;
393+
394+ if ( Helpers . IsEqualWithTolerance ( float . ReciprocalSqrtEstimate ( src [ 0 ] ) , dst [ 0 ] , ( float ) Helpers . DefaultToleranceForEstimates ) )
395+ {
396+ // We need to ensure the state is consistent to avoid an issue with roll forward: https://github.com/dotnet/runtime/issues/101846
397+ yield return Create ( TensorPrimitives . ReciprocalSqrtEstimate , T . ReciprocalSqrtEstimate , T . CreateTruncating ( Helpers . DefaultToleranceForEstimates ) ) ;
398+ }
399+
390400 yield return Create ( TensorPrimitives . Round , T . Round ) ;
391401 yield return Create ( TensorPrimitives . Sin , T . Sin , trigTolerance ) ;
392402 yield return Create ( TensorPrimitives . Sinh , T . Sinh , Helpers . DetermineTolerance < T > ( doubleTolerance : 1e-14 ) ) ;
You can’t perform that action at this time.
0 commit comments