public void TestCos() { for (Double deg = -360.0; deg <= 360.0; deg += 0.1) { Double rad = deg * DoublePrecision.Maths.Deg2Rad; Fixed32 f = rad; Fixed32 fs = Fixed32.Cos(f); Double result = fs.ToDouble(); Double expected = Math.Cos(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. } }
public static F32 Cos(F32 a) { return(FromRaw(Fixed32.Cos(a.Raw))); }
public static F32Vec4 Cos(F32Vec4 a) { return(new F32Vec4(Fixed32.Cos(a.RawX), Fixed32.Cos(a.RawY), Fixed32.Cos(a.RawZ), Fixed32.Cos(a.RawW))); }
public static F32Vec3 Cos(F32Vec3 a) { return(new F32Vec3(Fixed32.Cos(a.RawX), Fixed32.Cos(a.RawY), Fixed32.Cos(a.RawZ))); }
public static F32Vec2 Cos(F32Vec2 a) { return(new F32Vec2(Fixed32.Cos(a.RawX), Fixed32.Cos(a.RawY))); }