Пример #1
0
 public Value(BigRational doubleVal, Factors factors, Restrictions restrictions)
 {
     InitDouble(doubleVal, restrictions);
     this.factors = factors;
 }
Пример #2
0
 /// <summary>Decimal value</summary>
 public void InitDouble(BigRational val, Restrictions restrictions)
 {
     this.RationalValue = val;
     this.primaryNumType = NumberType.rational;
     if (val == (BigInteger)(val)) {
         //this is done to avoid the accumulation of miniscule errors:
         RationalValue = (BigInteger)val;
         primaryNumType = NumberType.integer;
         if (restrictions != Restrictions.dontFactorMe) {
             factors = new Factors((new List<BigInteger>(){(BigInteger)RationalValue}));
         }
     }
     rationalEvaluated = (double)RationalValue.Numerator / (double)RationalValue.Denominator;
 }