public void TestArcTan2() { for (Double x = -10f; x <= 10f; x += 1f) { for (Double y = -10f; y <= 10f; y += 1f) { Fixed64 fx = x; Fixed64 fy = y; Fixed64 fs = Fixed64.ArcTan2(fy, fx); Double result = fs.ToDouble(); Double expected = Math.Atan2(y, x); Assert.That(result, Is.EqualTo(expected).Within(MathsTests.TestTolerance). // Check that result is within test tolerance for Fixed64 Or.EqualTo(expected).Within(MathsTests.PercentageTolerance * Math.Abs(result))); // or that result is within test percentage for Fixed64. } } }