This commit is contained in:
@@ -21,7 +21,7 @@ public class PreciseMathRealPowTests
|
||||
(Units(input.High) + Units(input.Low)).ShouldBe(Units(high) + Units(low));
|
||||
BigInteger exponentUnits = Units(exponentHigh) + Units(scalar ? 0.0 : exponentLow);
|
||||
(Units(exponent.High) + Units(exponent.Low)).ShouldBe(exponentUnits);
|
||||
DoubleDouble actual = scalar ? DDMath.Pow(input, exponentHigh) : DDMath.Pow(input, exponent);
|
||||
DoubleDouble actual = scalar ? DoubleDouble.Pow(input, exponentHigh) : DoubleDouble.Pow(input, exponent);
|
||||
string context = $"{label}, scalar={scalar}: ({high:R}, {low:R})^({exponentHigh:R}, {exponentLow:R})";
|
||||
AssertReferenceBound(actual, reference, exponentUnits, context);
|
||||
}
|
||||
@@ -36,9 +36,9 @@ public class PreciseMathRealPowTests
|
||||
// These references are exact rational identities. The general ln/exp
|
||||
// implementation is approximate, so do not require universal bit equality.
|
||||
string reference = expected.ToString("e17", CultureInfo.InvariantCulture);
|
||||
AssertReferenceBound(DDMath.Pow(new DoubleDouble(input), exponent), reference,
|
||||
AssertReferenceBound(DoubleDouble.Pow(new DoubleDouble(input), exponent), reference,
|
||||
Units(exponent), "scalar exact binary reference");
|
||||
AssertReferenceBound(DDMath.Pow(new DoubleDouble(input), new DoubleDouble(exponent)), reference,
|
||||
AssertReferenceBound(DoubleDouble.Pow(new DoubleDouble(input), new DoubleDouble(exponent)), reference,
|
||||
Units(exponent), "DD exact binary reference");
|
||||
}
|
||||
|
||||
@@ -55,17 +55,17 @@ public class PreciseMathRealPowTests
|
||||
{
|
||||
foreach (int exponent in new[] { -63, -7, -1, 0, 1, 7, 63 })
|
||||
{
|
||||
DoubleDouble expected = DDMath.Pow(input, exponent);
|
||||
AssertBits(DDMath.Pow(input, (double)exponent), expected);
|
||||
AssertBits(DDMath.Pow(input, new DoubleDouble(exponent)), expected);
|
||||
DoubleDouble expected = DoubleDouble.Pow(input, exponent);
|
||||
AssertBits(DoubleDouble.Pow(input, (double)exponent), expected);
|
||||
AssertBits(DoubleDouble.Pow(input, new DoubleDouble(exponent)), expected);
|
||||
}
|
||||
}
|
||||
foreach (int exponent in new[] { int.MinValue, int.MaxValue })
|
||||
{
|
||||
DoubleDouble input = DoubleDouble.FromComponents(1.0, Math.ScaleB(1.0, -54));
|
||||
DoubleDouble expected = DDMath.Pow(input, exponent);
|
||||
AssertBits(DDMath.Pow(input, (double)exponent), expected);
|
||||
AssertBits(DDMath.Pow(input, new DoubleDouble(exponent)), expected);
|
||||
DoubleDouble expected = DoubleDouble.Pow(input, exponent);
|
||||
AssertBits(DoubleDouble.Pow(input, (double)exponent), expected);
|
||||
AssertBits(DoubleDouble.Pow(input, new DoubleDouble(exponent)), expected);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,8 +77,8 @@ public class PreciseMathRealPowTests
|
||||
foreach (double low in new[] { double.Epsilon, -double.Epsilon })
|
||||
{
|
||||
DoubleDouble input = DoubleDouble.FromComponents(high, low);
|
||||
AssertBits(DDMath.Pow(input, 1.0), input);
|
||||
AssertBits(DDMath.Pow(input, DoubleDouble.One), input);
|
||||
AssertBits(DoubleDouble.Pow(input, 1.0), input);
|
||||
AssertBits(DoubleDouble.Pow(input, DoubleDouble.One), input);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user