This commit is contained in:
@@ -12,7 +12,7 @@ public class PreciseMathReciprocalTests
|
||||
foreach (double low in new[] { 0.0, Math.ScaleB(1.0, -54), -Math.ScaleB(1.0, -54) })
|
||||
{
|
||||
DoubleDouble input = DoubleDouble.FromComponents(high, low);
|
||||
DoubleDouble actual = DDMath.Reciprocal(input);
|
||||
DoubleDouble actual = DoubleDouble.Reciprocal(input);
|
||||
actual.Low.ShouldNotBe(0.0);
|
||||
AssertReciprocalBound(input, actual);
|
||||
}
|
||||
@@ -25,7 +25,7 @@ public class PreciseMathReciprocalTests
|
||||
double.NaN, BitConverter.Int64BitsToDouble(0x7ff0000000000001L)];
|
||||
foreach (double value in values)
|
||||
{
|
||||
DoubleDouble actual = DDMath.Reciprocal(new DoubleDouble(value));
|
||||
DoubleDouble actual = DoubleDouble.Reciprocal(new DoubleDouble(value));
|
||||
// Binary64 is an independent oracle for special values only.
|
||||
double expected = 1.0 / value;
|
||||
BitConverter.DoubleToInt64Bits(actual.High).ShouldBe(
|
||||
@@ -44,7 +44,7 @@ public class PreciseMathReciprocalTests
|
||||
{
|
||||
foreach (double sign in new[] { -1.0, 1.0 })
|
||||
{
|
||||
DoubleDouble actual = DDMath.Reciprocal(new DoubleDouble(Math.ScaleB(sign, exponent)));
|
||||
DoubleDouble actual = DoubleDouble.Reciprocal(new DoubleDouble(Math.ScaleB(sign, exponent)));
|
||||
actual.High.ShouldBe(Math.ScaleB(sign, -exponent));
|
||||
BitConverter.DoubleToInt64Bits(actual.Low).ShouldBe(0L);
|
||||
DoubleDouble.IsCanonical(actual).ShouldBeTrue();
|
||||
@@ -104,7 +104,7 @@ public class PreciseMathReciprocalTests
|
||||
{
|
||||
double low = Math.ScaleB(lowSign, exponent);
|
||||
DoubleDouble input = DoubleDouble.FromComponents(sign, low);
|
||||
DoubleDouble actual = DDMath.Reciprocal(input);
|
||||
DoubleDouble actual = DoubleDouble.Reciprocal(input);
|
||||
actual.High.ShouldBe(sign);
|
||||
actual.Low.ShouldBe(-low);
|
||||
AssertReciprocalBound(input, actual);
|
||||
@@ -116,7 +116,7 @@ public class PreciseMathReciprocalTests
|
||||
private static void AssertMatchesDivision(DoubleDouble input)
|
||||
{
|
||||
DoubleDouble expected = 1.0 / input;
|
||||
DoubleDouble actual = DDMath.Reciprocal(input);
|
||||
DoubleDouble actual = DoubleDouble.Reciprocal(input);
|
||||
string context = $"Input: ({input.High:R}, {input.Low:R})";
|
||||
BitConverter.DoubleToInt64Bits(actual.High).ShouldBe(BitConverter.DoubleToInt64Bits(expected.High), context);
|
||||
BitConverter.DoubleToInt64Bits(actual.Low).ShouldBe(BitConverter.DoubleToInt64Bits(expected.Low), context);
|
||||
|
||||
Reference in New Issue
Block a user