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