Exemple #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;
     }
 }
Exemple #2
0
 public Fraction(BigInteger n, Fraction d)
     : this(n * d.d, d.n)
 {
 }
Exemple #3
0
 public void TestDigitCount()
 {
     Fraction f = new Fraction(17,1713);
     Assert.AreEqual(2U, f.NumeratorDigits());
     Assert.AreEqual(4U, f.DenominatorDigits());
 }
Exemple #4
0
 private static bool Matches(Fraction f)
 {
     return f.NumeratorDigits() > f.DenominatorDigits();
 }
Exemple #5
0
 public bool Equals(Fraction other)
 {
     return(num == other.num && den == other.den);
 }