Пример #1
0
 public void FloatGetHashCodeTest()
 {
     using (var a = new HugeFloat("-2225098325034502983450298357.40293845721"))
     {
         Assert.AreNotEqual(0, a.GetHashCode());
         Assert.AreEqual(a.GetHashCode(), (a + 0).GetHashCode());
         Assert.AreNotEqual(a.GetHashCode(), (-a).GetHashCode());
     }
 }
Пример #2
0
 public void ExpressionHashCodeCalculatedToDefaultPrecision()
 {
     using (var a = new HugeFloat(1))
         using (var b = new HugeFloat(13))
             using (var c = new HugeFloat("12345234589234059823475029384572323"))
             {
                 ShiftLeftBy62(c);
                 var cHash = c.GetHashCode();
                 var expr  = a / b + c;
                 Assert.AreEqual(cHash, expr.GetHashCode());
                 HugeFloat.DefaultPrecision = 256;
                 Assert.AreEqual(cHash, c.GetHashCode());
                 Assert.AreNotEqual(cHash, expr.GetHashCode());
                 HugeFloat.DefaultPrecision = 128;
             }
 }
Пример #3
0
 public void FloatGetHashCodeTest()
 {
     using (var a = new HugeFloat("-2225098325034502983450298357.40293845721"))
     {
         Assert.AreNotEqual(0, a.GetHashCode());
         Assert.AreEqual(a.GetHashCode(), (a + 0).GetHashCode());
         Assert.AreNotEqual(a.GetHashCode(), (-a).GetHashCode());
     }
 }
Пример #4
0
 public void ExpressionHashCodeCalculatedToDefaultPrecision()
 {
     using (var a = new HugeFloat(1))
     using (var b = new HugeFloat(13))
     using (var c = new HugeFloat("12345234589234059823475029384572323"))
     {
         ShiftLeftBy62(c);
         var cHash = c.GetHashCode();
         var expr = a / b + c;
         Assert.AreEqual(cHash, expr.GetHashCode());
         HugeFloat.DefaultPrecision = 256;
         Assert.AreEqual(cHash, c.GetHashCode());
         Assert.AreNotEqual(cHash, expr.GetHashCode());
         HugeFloat.DefaultPrecision = 128;
     }
 }