Beispiel #1
0
 public void TestArcCos()
 {
     for (Double x = -1.0; x <= 1.0; x += 0.01)
     {
         Double  rad      = x * DoublePrecision.Maths.Deg2Rad;
         Fixed32 f        = rad;
         Fixed32 fs       = Fixed32.ArcCos(f);
         Double  result   = fs.ToDouble();
         Double  expected = Math.Acos(rad);
         Assert.That(result,
                     Is.EqualTo(expected).Within(MathsTests.TestTolerance).                           // Check that result is within test tolerance for Fixed32
                     Or.EqualTo(expected).Within(MathsTests.PercentageTolerance * Math.Abs(result))); // or that result is within test percentage for Fixed32.
     }
 }