Example #1
0
 static IEnumerable<Fraction> Sequence(Fraction f)
 {
     while (true)
     {
         Fraction result = new Fraction(1) + new Fraction(1, (new Fraction(1) + f));
         yield return result;
         f = result;
     }
 }
Example #2
0
 public Fraction(BigInteger n, Fraction d)
     : this(n * d.d, d.n)
 {
 }
Example #3
0
 public void TestDigitCount()
 {
     Fraction f = new Fraction(17,1713);
     Assert.AreEqual(2U, f.NumeratorDigits());
     Assert.AreEqual(4U, f.DenominatorDigits());
 }
Example #4
0
 private static bool Matches(Fraction f)
 {
     return f.NumeratorDigits() > f.DenominatorDigits();
 }
Example #5
0
 public bool Equals(Fraction other)
 {
     return(num == other.num && den == other.den);
 }