예제 #1
0
 public void TestMethodCos()
 {
     for (int i = 0; i < testCount; i++)
     {
         double  d  = Random.NextDouble();
         decimal d1 = (decimal)d;
         d  = Math.Cos(d);
         d1 = DecimalMath.Cos(d1);
         Debug.Assert(DecimalMath.Abs((decimal)d - d1) < epsilon);
     }
 }
예제 #2
0
 public void TestMethodAtan2()
 {
     for (int i = 0; i < testCount; i++)
     {
         double  x  = Random.NextDouble();
         double  y  = Random.NextDouble();
         decimal dx = (decimal)x;
         decimal dy = (decimal)y;
         var     d  = Math.Atan2(y, x);
         var     z  = DecimalMath.Atan2(dy, dx);
         Debug.Assert(DecimalMath.Abs((decimal)d - z) < epsilon);
     }
 }
예제 #3
0
 public void TestMethodExp()
 {
     for (int i = 0; i < testCount; i++)
     {
         double  d  = Random.NextDouble();
         decimal d1 = (decimal)d;
         d  = Math.Exp(d);
         d1 = DecimalMath.Exp(d1);
         Debug.WriteLine("d=" + d);
         Debug.WriteLine("d1=" + d1);
         Debug.Assert(DecimalMath.Abs((decimal)d - d1) < epsilon);
     }
 }