Пример #1
0
 public infRational(string input1, string input2)
 {   //explicit value constructor 2
     this.Numerator   = new InfInt(input1);
     this.Denominator = new InfInt(input2);
     if ((Numerator.CompareTo(new InfInt("0")) < 0) || Denominator.CompareTo(new InfInt("0")) < 0)     // if either numerator or denominator is negative
     {
         if ((Numerator.CompareTo(new InfInt("0")) < 0) && Denominator.CompareTo(new InfInt("0")) < 0) // if both are negative
         {
             Positive = true;
         }
         else
         {
             Positive = false;
         }
     }
     else
     {
         Positive = true;
     }
 }
Пример #2
0
 public infRational(InfInt num, InfInt denom)
 {   //explicit value constructor 1
     this.Numerator   = num;
     this.Denominator = denom;
     if ((Numerator.CompareTo(new InfInt("0")) < 0) || Denominator.CompareTo(new InfInt("0")) < 0)     // if either numerator or denominator is negative
     {
         if ((Numerator.CompareTo(new InfInt("0")) < 0) && Denominator.CompareTo(new InfInt("0")) < 0) // if both are negative
         {
             Positive = true;
         }
         else
         {
             Positive = false;
         }
     }
     else
     {
         Positive = true;
     }
 }