Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions src/libraries/Common/tests/System/GenericMathTestMemberData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1372,13 +1372,8 @@ public static IEnumerable<object[]> MaxDouble
yield return new object[] { double.NegativeInfinity, double.NaN, double.NaN };
yield return new object[] { double.NaN, double.PositiveInfinity, double.NaN };
yield return new object[] { double.NaN, double.NegativeInfinity, double.NaN };
// [ActiveIssue("https://github.com/dotnet/runtime/issues/133311")]
// [ActiveIssue("https://github.com/dotnet/runtime/issues/134268")]
if (!((PlatformDetection.IsMonoRuntime && PlatformDetection.IsWasm) || PlatformDetection.IsWasmReadyToRun))
{
yield return new object[] { PositiveNaNDouble, -0.0, PositiveNaNDouble };
yield return new object[] { -0.0, NegativeNaNDouble, NegativeNaNDouble };
}
yield return new object[] { PositiveNaNDouble, -0.0, PositiveNaNDouble };
yield return new object[] { -0.0, NegativeNaNDouble, NegativeNaNDouble };
yield return new object[] { -0.0f, 0.0f, 0.0f };
yield return new object[] { 0.0f, -0.0f, 0.0f };
yield return new object[] { 2.0f, -3.0f, 2.0f };
Expand Down Expand Up @@ -1577,13 +1572,8 @@ public static IEnumerable<object[]> MinDouble
yield return new object[] { double.NegativeInfinity, double.NaN, double.NaN };
yield return new object[] { double.NaN, double.PositiveInfinity, double.NaN };
yield return new object[] { double.NaN, double.NegativeInfinity, double.NaN };
// [ActiveIssue("https://github.com/dotnet/runtime/issues/133311")]
// [ActiveIssue("https://github.com/dotnet/runtime/issues/134268")]
if (!((PlatformDetection.IsMonoRuntime && PlatformDetection.IsWasm) || PlatformDetection.IsWasmReadyToRun))
{
yield return new object[] { PositiveNaNDouble, -0.0, PositiveNaNDouble };
yield return new object[] { -0.0, NegativeNaNDouble, NegativeNaNDouble };
}
yield return new object[] { PositiveNaNDouble, -0.0, PositiveNaNDouble };
yield return new object[] { -0.0, NegativeNaNDouble, NegativeNaNDouble };
yield return new object[] { -0.0f, 0.0f, -0.0f };
yield return new object[] { 0.0f, -0.0f, -0.0f };
yield return new object[] { 2.0f, -3.0f, -3.0f };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1222,9 +1222,8 @@ public static void Equal(double expected, double actual)
return;
}

if (PlatformDetection.IsRiscV64Process && double.IsNaN(expected) && double.IsNaN(actual))
if (!PlatformDetection.IsNaNPayloadPreservationExpected && double.IsNaN(expected) && double.IsNaN(actual))
Comment thread
tannergooding marked this conversation as resolved.
Comment thread
tannergooding marked this conversation as resolved.
{
// RISC-V does not preserve payload
return;
}

Expand All @@ -1247,9 +1246,8 @@ static unsafe int SingleToInt32Bits(float value)
return;
}

if (PlatformDetection.IsRiscV64Process && float.IsNaN(expected) && float.IsNaN(actual))
if (!PlatformDetection.IsNaNPayloadPreservationExpected && float.IsNaN(expected) && float.IsNaN(actual))
{
// RISC-V does not preserve payload
return;
}

Expand All @@ -1268,9 +1266,8 @@ public static void Equal(Half expected, Half actual)
return;
}

if (PlatformDetection.IsRiscV64Process && Half.IsNaN(expected) && Half.IsNaN(actual))
if (!PlatformDetection.IsNaNPayloadPreservationExpected && Half.IsNaN(expected) && Half.IsNaN(actual))
{
// RISC-V does not preserve payload
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ public static partial class PlatformDetection
public static bool Is64BitProcess => IntPtr.Size == 8;
public static bool IsNotWindows => !IsWindows;

// Test expectation for floating-point operations, not a platform-wide guarantee.
// Bitcasts and other explicitly bit-preserving operations should still be tested exactly.
public static bool IsNaNPayloadPreservationExpected => !IsRiscV64Process && !IsWasm;

private static volatile int s_isPrivilegedProcess = -1;
public static bool IsPrivilegedProcess
{
Expand Down
Loading