예제 #1
0
        public void TestAbs_Overflow()
        {
            Fixed32 result = Fixed32.MinValue;

            Fixed32.Abs(ref result, out result);
            Fixed32 expected = Fixed32.MaxValue;

            Assert.That(result, Is.EqualTo(expected));
        }
예제 #2
0
 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));
     }
 }
예제 #3
0
파일: F32.cs 프로젝트: jlauha/FixPointCS
 public static F32 Abs(F32 a)
 {
     return(FromRaw(Fixed32.Abs(a.Raw)));
 }