public void TestLessThanOrApproximately() { Assert.IsTrue(XH.LessThanOrApprox(0.0, 0.0)); Assert.IsTrue(XH.LessThanOrApprox(3.4, 3.4)); Assert.IsTrue(XH.LessThanOrApprox(-3.4, -3.4)); Assert.IsTrue(XH.LessThanOrApprox(34E200, 34E200)); Assert.IsTrue(XH.LessThanOrApprox(-34E200, -34E200)); Assert.IsTrue(XH.LessThanOrApprox(0.0, 1.0)); Assert.IsFalse(XH.LessThanOrApprox(1.0, 0.0)); Assert.IsFalse(XH.LessThanOrApprox(0.0, -1.0)); Assert.IsTrue(XH.LessThanOrApprox(-1.0, 0.0)); Assert.IsTrue(XH.LessThanOrApprox(4.0, AddSmall(4.0))); Assert.IsTrue(XH.LessThanOrApprox(4.0, AddSome(4.0))); Assert.IsTrue(XH.LessThanOrApprox(-4.0, -AddSmall(4.0))); Assert.IsFalse(XH.LessThanOrApprox(-4.0, -AddSome(4.0))); Assert.IsTrue(XH.LessThanOrApprox(3000, AddSmall(3000.0))); Assert.IsTrue(XH.LessThanOrApprox(3000.0, AddSome(3000.0))); Assert.IsTrue(XH.LessThanOrApprox(-3000.0, -AddSmall(3000.0))); Assert.IsFalse(XH.LessThanOrApprox(-3000.0, -AddSome(3000.0))); Assert.IsTrue(XH.LessThanOrApprox(0.0000001, AddSmall(0.0000001))); Assert.IsTrue(XH.LessThanOrApprox(0.0000001, AddSome(0.0000001))); Assert.IsTrue(XH.LessThanOrApprox(-0.0000001, -AddSmall(0.0000001))); Assert.IsFalse(XH.LessThanOrApprox(-0.0000001, -AddSome(0.0000001))); }
public void TestApproximatelyEquals() { Assert.IsTrue(XH.ApproximatelyEquals(0.0, 0.0)); Assert.IsTrue(XH.ApproximatelyEquals(3.4, 3.4)); Assert.IsTrue(XH.ApproximatelyEquals(-3.4, -3.4)); Assert.IsTrue(XH.ApproximatelyEquals(34E200, 34E200)); Assert.IsTrue(XH.ApproximatelyEquals(-34E200, -34E200)); Assert.IsFalse(XH.ApproximatelyEquals(0.0, 1.0)); Assert.IsFalse(XH.ApproximatelyEquals(1.0, 0.0)); Assert.IsFalse(XH.ApproximatelyEquals(0.0, -1.0)); Assert.IsFalse(XH.ApproximatelyEquals(-1.0, 0.0)); Assert.IsTrue(XH.ApproximatelyEquals(4.0, AddSmall(4.0))); Assert.IsFalse(XH.ApproximatelyEquals(4.0, AddSome(4.0))); Assert.IsTrue(XH.ApproximatelyEquals(-4.0, -AddSmall(4.0))); Assert.IsFalse(XH.ApproximatelyEquals(-4.0, -AddSome(4.0))); Assert.IsTrue(XH.ApproximatelyEquals(3000, AddSmall(3000.0))); Assert.IsFalse(XH.ApproximatelyEquals(3000.0, AddSome(3000.0))); Assert.IsTrue(XH.ApproximatelyEquals(-3000.0, -AddSmall(3000.0))); Assert.IsFalse(XH.ApproximatelyEquals(-3000.0, -AddSome(3000.0))); Assert.IsTrue(XH.ApproximatelyEquals(0.0000001, AddSmall(0.0000001))); Assert.IsFalse(XH.ApproximatelyEquals(0.0000001, AddSome(0.0000001))); Assert.IsTrue(XH.ApproximatelyEquals(-0.0000001, -AddSmall(0.0000001))); Assert.IsFalse(XH.ApproximatelyEquals(-0.0000001, -AddSome(0.0000001))); }