public void TestAbs_Overflow() { Fixed64 result = Fixed64.MinValue; Fixed64.Abs(ref result, out result); Fixed64 expected = Fixed64.MaxValue; Assert.That(result, Is.EqualTo(expected)); }
/// <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); }
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)); } }
public static Fixed64 Distance(Fixed64 value1, Fixed64 value2) { return(Fixed64.Abs(value1 - value2)); }
/// <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)); }
public static F64 Abs(F64 a) { return(FromRaw(Fixed64.Abs(a.Raw))); }
public static bool Approximately(F64 a, F64 b, int _ApproximatelyValue) { return(Fixed64.Abs(a.Raw - b.Raw) <= _ApproximatelyValue); }