   /// Raises this rational value to the power of `exp`.
   public func toPowerOf(exp: T) -> Rational<T> {
     return Rational(pow(numerator, exp), pow(denominator, exp))
+  }
+  
+  /// Returns the greatest common denominator for the two given rational numbers
+  public static func gcd(x: Rational<T>, _ y: Rational<T>) -> Rational<T> {
+    return Rational(Rational.gcd(x.numerator, y.numerator),
+                    Rational.lcm(x.denominator, y.denominator))
+  }
+  
+  /// Returns the least common multiplier for the two given rational numbers
+  public static func lcm(x: Rational<T>, _ y: Rational<T>) -> Rational<T> {
+    let (xn, yn, denom) = x.commonDenomWith(y)
+    return Rational(Rational.lcm(xn, yn), denom)
   }
 }
 

  ///          0 if `self` is equals to `rhs`,
  ///         +1 if `self` is greater than `rhs`
  public func compareTo(rhs: Rational<T>) -> Int {
    let (n1, n2, _) = commonDenomWith(rhs)
    return n1 == n2 ? 0 : (n1 < n2 ? -1 : 1)
  }
  
  /// Returns the sum of this rational value and `rhs`.
  public func plus(rhs: Rational<T>) -> Rational<T> {
    let (n1, n2, denom) = commonDenomWith(rhs)
    return Rational(n1 + n2, denom)
  }
  
  /// Returns the difference between this rational value and `rhs`.
  public func minus(rhs: Rational<T>) -> Rational<T> {
    let (n1, n2, denom) = commonDenomWith(rhs)
    return Rational(n1 - n2, denom)
  }
  

  }
  
  /// Compute the greatest common divisor for `x` and `y`.
  public static func gcd(x: T, _ y: T) -> T {
    var (x, y, rest) = (x, y, x % y)
    while rest > 0 {
      x = y
      y = rest
      rest = x % y
    }
    return y
  }
  
  /// Compute the least common multiplier of `x` and `y`.
  public static func lcm(x: T, _ y: T) -> T {
    var abs = x * y
    if abs < 0 {
      abs = -abs
    }
    return abs / Rational.gcd(x, y)
  }
  
  /// Determine the smallest common denominator between `self` and `other` and return
