コード例 #1
0
 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));
     }
 }
コード例 #2
0
 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));
     }
 }
コード例 #3
0
 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));
     }
 }
コード例 #4
0
 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));
     }
 }
コード例 #5
0
 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));
     }
 }
コード例 #6
0
 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)
                           ));
     }
 }
コード例 #7
0
        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));
            }
        }
コード例 #8
0
        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));
            }
        }
コード例 #9
0
        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));
            }
        }