public void DoubleDoubleSqrt() { foreach (DoubleDouble x in DoubleDoubleTest.GetRandomDoubleDoubles(1.0E-4, 1.0E4, 16)) { DoubleDouble y = DoubleDouble.Sqrt(x); Assert.IsTrue(DoubleDoubleTest.IsNearlyEqual(y * y, x)); } }
public void DoubleDoubleTrigSymmetries() { foreach (DoubleDouble x in DoubleDoubleTest.GetRandomDoubleDoubles(1.0E-3, 1.0E3, 8)) { Assert.IsTrue(DoubleDouble.Sin(x) == -DoubleDouble.Sin(-x)); Assert.IsTrue(DoubleDouble.Cos(x) == DoubleDouble.Cos(-x)); } }
public void DoubleDoubleErrorFunctionReflection() { foreach (DoubleDouble x in DoubleDoubleTest.GetRandomDoubleDoubles(1.0E-4, 1.0E4, 8)) { DoubleDouble xErf = AdvancedDoubleDoubleMath.Erf(x); Assert.IsTrue(-AdvancedDoubleDoubleMath.Erf(-x) == AdvancedDoubleDoubleMath.Erf(x)); } }
public void DoubleDoubleLogExp() { foreach (DoubleDouble x in DoubleDoubleTest.GetRandomDoubleDoubles(1.0E-2, 1.0E6, 16)) { DoubleDouble xLog = DoubleDouble.Log(x); DoubleDouble xLogExp = DoubleDouble.Exp(xLog); Assert.IsTrue(DoubleDoubleTest.IsNearlyEqual(xLogExp, x)); } }
public void DoubleDoubleErrorFunctionComplementiarity() { foreach (DoubleDouble x in DoubleDoubleTest.GetRandomDoubleDoubles(1.0E-2, 1.0E2, 8)) { DoubleDouble xErf = AdvancedDoubleDoubleMath.Erf(x); DoubleDouble xErfc = AdvancedDoubleDoubleMath.Erfc(x); Assert.IsTrue(DoubleDoubleTest.IsNearlyEqual(xErf + xErfc, DoubleDouble.One)); } }
public void DoubleDoubleLogGammaRecurrence() { foreach (DoubleDouble x in DoubleDoubleTest.GetRandomDoubleDoubles(1.0, 1.0E4, 8)) { Assert.IsTrue(DoubleDoubleTest.IsNearlyEqual( DoubleDouble.Log(x) + AdvancedDoubleDoubleMath.LogGamma(x), AdvancedDoubleDoubleMath.LogGamma(x + DoubleDouble.One) )); } }
public void DoubleDoubleSqrtAgreement() { foreach (DoubleDouble x in DoubleDoubleTest.GetRandomDoubleDoubles(1.0E-4, 1.0E4, 16)) { DoubleDouble xSqrt = DoubleDouble.Sqrt(x); double xSqrtAsDouble = (double)xSqrt; double xAsDouble = (double)x; double xAsDoubleSqrt = Math.Sqrt(xAsDouble); Assert.IsTrue(TestUtilities.IsNearlyEqual(xSqrtAsDouble, xAsDoubleSqrt)); } }
public void DoubleDoubleLogGammaAgreement() { foreach (DoubleDouble x in DoubleDoubleTest.GetRandomDoubleDoubles(1.0E-2, 1.0E3, 12)) { DoubleDouble xLogGamma = AdvancedDoubleDoubleMath.LogGamma(x); double xLogGammaAsDouble = (double)xLogGamma; double xAsDouble = (double)x; double xAsDoubleLogGamma = AdvancedMath.LogGamma(xAsDouble); Assert.IsTrue(TestUtilities.IsNearlyEqual(xLogGammaAsDouble, xAsDoubleLogGamma)); } }
public void DoubleDoubleErrorFunctionAgreement() { foreach (DoubleDouble x in DoubleDoubleTest.GetRandomDoubleDoubles(1.0E-2, 1.0E2, 8)) { DoubleDouble xErf = AdvancedDoubleDoubleMath.Erf(x); double xErfAsDouble = (double)xErf; double xAsDouble = (double)x; double xAsDoubleErf = AdvancedMath.Erf(xAsDouble); Assert.IsTrue(TestUtilities.IsNearlyEqual(xErfAsDouble, xAsDoubleErf)); DoubleDouble xErfc = AdvancedDoubleDoubleMath.Erfc(x); Assert.IsTrue(DoubleDoubleTest.IsNearlyEqual(xErf + xErfc, DoubleDouble.One)); } }