Exemplo n.º 1
0
        public void TestAbs_Overflow()
        {
            Fixed64 result = Fixed64.MinValue;

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

            Assert.That(result, Is.EqualTo(expected));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Changes every sign of the matrix entry to '+'
 /// </summary>
 /// <param name="matrix">The matrix.</param>
 /// <param name="result">The absolute matrix.</param>
 public static void Absolute(ref Fixed64Matrix matrix, out Fixed64Matrix result)
 {
     result.M11 = Fixed64.Abs(matrix.M11);
     result.M12 = Fixed64.Abs(matrix.M12);
     result.M13 = Fixed64.Abs(matrix.M13);
     result.M21 = Fixed64.Abs(matrix.M21);
     result.M22 = Fixed64.Abs(matrix.M22);
     result.M23 = Fixed64.Abs(matrix.M23);
     result.M31 = Fixed64.Abs(matrix.M31);
     result.M32 = Fixed64.Abs(matrix.M32);
     result.M33 = Fixed64.Abs(matrix.M33);
 }
Exemplo n.º 3
0
 public void TestAbs()
 {
     for (int i = 0; i < d_test_values.Length; ++i)
     {
         Fixed64 fi = d_test_values[i];
         Fixed64 fa = fi;
         Fixed64.Abs(ref fa, out fa);
         Double  result   = fa.ToDouble();
         Double  expected = Math.Abs(d_test_values[i]);
         Fixed64 f        = expected;
         Assert.That(result, Is.EqualTo(expected).Within(MathsTests.TestTolerance));
     }
 }
Exemplo n.º 4
0
 public static Fixed64 Distance(Fixed64 value1, Fixed64 value2)
 {
     return(Fixed64.Abs(value1 - value2));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Returns the absolute value of a Fix64 number.
 /// Note: Abs(Fix64.MinValue) == Fix64.MaxValue.
 /// </summary>
 public static Fixed64 Abs(Fixed64 value)
 {
     return(Fixed64.Abs(value));
 }
Exemplo n.º 6
0
 public static F64 Abs(F64 a)
 {
     return(FromRaw(Fixed64.Abs(a.Raw)));
 }
Exemplo n.º 7
0
 public static bool Approximately(F64 a, F64 b, int _ApproximatelyValue)
 {
     return(Fixed64.Abs(a.Raw - b.Raw) <= _ApproximatelyValue);
 }