예제 #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
파일: Precision.cs 프로젝트: wbhart/mpir
 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;
     }
 }