static void AssertEqual(MathObject a, Double b, double tolerance = 0.00000001) { var x = (DoubleFloat)a; var y = new DoubleFloat(b); if (Math.Abs(x.val - y.val) > tolerance) Console.WriteLine("{0} and {1} are not equal", x.val, y.val); }
static void AssertEqual(DoubleFloat a, DoubleFloat b, double tolerance = 0.00000001) { if (Math.Abs(a.val - b.val) > tolerance) Console.WriteLine("{0} and {1} are not equal", a.val, b.val); }
static List<MathObject> SimplifyDoubleNumberSum(DoubleFloat a, Number b) { double val = 0.0; if (b is DoubleFloat) val = a.val + ((DoubleFloat)b).val; if (b is Integer) val = a.val + ((Integer)b).val; if (b is Fraction) val = a.val + ((Fraction)b).ToDouble().val; if (val == 0.0) return new List<MathObject>() { }; return new List<MathObject>() { new DoubleFloat(val) }; }