Exemple #1
0
 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));
     }
 }
Exemple #2
0
 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));
     }
 }
Exemple #3
0
 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));
     }
 }
Exemple #4
0
 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));
         }
 }
Exemple #5
0
 public void FloatEqualsNonExpression()
 {
     using (var a = new HugeFloat("-2225098325034502983450.29835740293845721"))
     {
         Assert.IsFalse(a.Equals("abc"));
     }
 }
Exemple #6
0
        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());
            }
        }
Exemple #7
0
 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());
     }
 }
Exemple #8
0
 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));
     }
 }
Exemple #9
0
 public void FloatEqualsNonExpression()
 {
     using (var a = new HugeFloat("-2225098325034502983450.29835740293845721"))
     {
         Assert.IsFalse(a.Equals("abc"));
     }
 }
Exemple #10
0
 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));
     }
 }
Exemple #11
0
 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));
     }
 }
Exemple #12
0
 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));
     }
 }