public void FloatEqualsLimb() { using (var a = new HugeFloat(Platform.Select("222509832503", "2225098323"))) { var b = Platform.Ui(222509832504, 2225098324); Assert.IsFalse(a.Equals(b + 1)); Assert.IsTrue(a.Equals(b - 1)); Assert.IsTrue((a + 1).Equals(b)); } }
public void FloatEqualsSignedLimb() { using (var a = new HugeFloat(Platform.Select("-222509832505", "-222509835"))) { var b = Platform.Si(-222509832504, -222509834); Assert.IsFalse(a.Equals(b + 1)); Assert.IsTrue(a.Equals(b - 1)); Assert.IsTrue((a + 1).Equals(b)); } }
public void FloatEqualsDouble() { using (var a = new HugeFloat("-222509832505")) { double b = -222509832504; Assert.IsFalse(a.Equals(b + 1)); Assert.IsTrue(a.Equals(b - 1)); Assert.IsTrue((a + 1).Equals(b)); Assert.IsFalse((a + 1).Equals(b + 0.1)); } }
public void FloatEqualsHugeFloat() { using (var a = new HugeFloat("-2225098325034502983451.29835740293845721")) using (var b = new HugeFloat("2225098325034502983450.29835740293845721")) { Assert.IsFalse(b.Equals(a)); Assert.IsFalse(a.Equals(b + 1)); Assert.IsTrue((a + 1).Equals(-b)); Assert.IsFalse(a.Equals(null)); Assert.IsTrue(Equals(a + 1, -b)); } }
public void FloatEqualsNonExpression() { using (var a = new HugeFloat("-2225098325034502983450.29835740293845721")) { Assert.IsFalse(a.Equals("abc")); } }
public void FloatToAndFromDouble() { using (var a = new HugeFloat()) { a.SetTo(-123.25); double c = a.ToDouble(); Assert.IsTrue(c.Equals(-123.25)); Assert.IsTrue(a.Equals(-123.25)); Assert.AreEqual("-0.12325@3", a.ToString()); } }
public void FloatToAndFromDouble2() { using (var a = new HugeFloat()) { a.SetTo(-123.25); var exp = 0; double c = a.ToDouble(out exp); Assert.IsTrue(c.Equals(-0.962890625)); Assert.AreEqual(7L, exp); Assert.IsTrue(a.Equals(-123.25)); Assert.AreEqual("-0.12325@3", a.ToString()); } }