operators refactoring
.NET Test / .NET tests (push) Successful in 2m11s

This commit is contained in:
2026-09-24 00:39:59 +04:00
parent 3de9457fdc
commit ac93744579
26 changed files with 651 additions and 334 deletions
@@ -20,7 +20,6 @@ public class DoubleDoubleExponentialFunctionsTests
DoubleDouble actual = Evaluate(operation, input);
DoubleDouble.IsCanonical(actual).ShouldBeTrue();
AssertBits(actual, EvaluateGeneric(operation, input));
AssertBits(actual, EvaluateFacade(operation, input));
if (overflow)
{
AssertBits(DoubleDouble.PositiveInfinity, actual);
@@ -57,7 +56,7 @@ public class DoubleDoubleExponentialFunctionsTests
}
[Fact]
public void NaturalExponentialIsAvailableOnTheTypeAndMatchesFacadeBits()
public void NaturalExponentialMatchesGenericDispatchBits()
{
DoubleDouble[] values = [DoubleDouble.Zero, DoubleDouble.NegativeZero,
DoubleDouble.NaN, DoubleDouble.PositiveInfinity, DoubleDouble.NegativeInfinity,
@@ -65,7 +64,7 @@ public class DoubleDoubleExponentialFunctionsTests
new(double.MaxValue), DoubleDouble.FromComponents(1.0, Math.ScaleB(1.0, -1000))];
foreach (DoubleDouble value in values)
{
AssertBits(DDMath.Exp(value), DoubleDouble.Exp(value));
AssertBits(DoubleDouble.Exp(value), EvaluateGeneric("Exp", value));
}
}
@@ -117,7 +116,6 @@ public class DoubleDoubleExponentialFunctionsTests
DoubleDouble input = DoubleDouble.FromComponents(exponent, sign * double.Epsilon);
DoubleDouble expected = DoubleDouble.FromComponents(Math.ScaleB(1.0, exponent), sign * expectedLow);
AssertBits(expected, DoubleDouble.Exp2(input));
AssertBits(expected, DDMath.Exp2(input));
}
}
@@ -128,7 +126,7 @@ public class DoubleDoubleExponentialFunctionsTests
[InlineData("ExpM1")]
[InlineData("Exp2M1")]
[InlineData("Exp10M1")]
public void CompleteContractHasGenericDispatchAndThinFacade(string operation)
public void CompleteContractHasGenericDispatch(string operation)
{
bool minusOne = operation.EndsWith("M1", StringComparison.Ordinal);
DoubleDouble[] values = [DoubleDouble.Zero, DoubleDouble.NegativeZero,
@@ -141,7 +139,6 @@ public class DoubleDoubleExponentialFunctionsTests
DoubleDouble actual = Evaluate(operation, value);
DoubleDouble.IsCanonical(actual).ShouldBeTrue();
AssertBits(actual, EvaluateGeneric(operation, value));
AssertBits(actual, EvaluateFacade(operation, value));
if (DoubleDouble.IsZero(value))
{
AssertBits(minusOne ? value : DoubleDouble.One, actual);
@@ -189,20 +186,6 @@ public class DoubleDoubleExponentialFunctionsTests
};
}
private static DoubleDouble EvaluateFacade(string operation, DoubleDouble value)
{
return operation switch
{
"Exp" => DDMath.Exp(value),
"Exp2" => DDMath.Exp2(value),
"Exp10" => DDMath.Exp10(value),
"ExpM1" => DDMath.ExpM1(value),
"Exp2M1" => DDMath.Exp2M1(value),
"Exp10M1" => DDMath.Exp10M1(value),
_ => throw new ArgumentOutOfRangeException(nameof(operation))
};
}
private static BigInteger Units(double value)
{
long bits = BitConverter.DoubleToInt64Bits(value);