Exemplo n.º 1
0
            public static IntervalElement /*!*/ Factory(BigNum inf, BigNum sup)
            {
                Contract.Ensures(Contract.Result <IntervalElement>() != null);
                ExtendedInt /*!*/ i = ExtendedInt.Factory(inf);
                ExtendedInt /*!*/ s = ExtendedInt.Factory(sup);

                return(Factory(i, s));
            }
Exemplo n.º 2
0
 // Subtraction
 public static ExtendedInt /*!*/ operator -(ExtendedInt /*!*/ a, ExtendedInt /*!*/ b)
 {
     Contract.Requires(b != null);
     Contract.Requires(a != null);
     Contract.Ensures(Contract.Result <ExtendedInt>() != null);
     if (a is InfinitaryInt)
     {
         return(a);
     }
     else if (b is InfinitaryInt)
     {
         return(UnaryMinus(b));
     }
     else
     {
         return(ExtendedInt.Factory(a.Value - b.Value));
     }
 }
Exemplo n.º 3
0
 // Modulo
 public static ExtendedInt /*!*/ operator %(ExtendedInt /*!*/ a, ExtendedInt /*!*/ b)
 {
     Contract.Requires(b != null);
     Contract.Requires(a != null);
     Contract.Ensures(Contract.Result <ExtendedInt>() != null);
     if (b.IsZero)
     {
         return(a.IsPositive ? (ExtendedInt)cachedPlusInf : cachedMinusInf);
     }
     if (a is InfinitaryInt)
     {
         return(a);
     }
     else if (b is InfinitaryInt)
     {
         return(b);
     }
     else
     {
         return(ExtendedInt.Factory(a.Value % b.Value));
     }
 }
Exemplo n.º 4
0
 // Construct the interval [inf, sup]
 protected IntervalElement(BigNum infInt, BigNum supInt)
 {
     this.inf = ExtendedInt.Factory(infInt);
     this.sup = ExtendedInt.Factory(supInt);
     // base();   // to please the compiler...
 }
Exemplo n.º 5
0
 // Construct the inteval [val, val]
 protected IntervalElement(BigNum val)
 {
     this.inf = this.sup = ExtendedInt.Factory(val);
     // base();
 }