public void TestAbs_Overflow() { Fixed32 result = Fixed32.MinValue; Fixed32.Abs(ref result, out result); Fixed32 expected = Fixed32.MaxValue; Assert.That(result, Is.EqualTo(expected)); }
public void TestAbs() { for (int i = 0; i < d_test_values.Length; ++i) { Fixed32 fi = d_test_values[i]; Fixed32 fa = fi; Fixed32.Abs(ref fa, out fa); Double result = fa.ToDouble(); Double expected = Math.Abs(d_test_values[i]); Fixed32 f = expected; Assert.That(result, Is.EqualTo(expected).Within(MathsTests.TestTolerance)); } }
public static F32 Abs(F32 a) { return(FromRaw(Fixed32.Abs(a.Raw))); }