diff --git a/cf.cabal b/cf.cabal
--- a/cf.cabal
+++ b/cf.cabal
@@ -1,5 +1,5 @@
 name:                cf
-version:             0.2
+version:             0.3
 synopsis:            Exact real arithmetic using continued fractions
 license:             MIT   
 license-file:        LICENSE
diff --git a/src/Math/ContinuedFraction.hs b/src/Math/ContinuedFraction.hs
--- a/src/Math/ContinuedFraction.hs
+++ b/src/Math/ContinuedFraction.hs
@@ -4,6 +4,7 @@
 {-# LANGUAGE TypeFamilies #-}
 module Math.ContinuedFraction (
   CF,
+  CF'(..),
   cfString,
   cfcf
 ) where
@@ -202,7 +203,7 @@
           Bihom a -> Interval (FractionField a) -> Interval (FractionField a) -> Bool
 select bh x@(Interval ix sx) y@(Interval iy sy) = intX `smallerThan` intY
   where intX = if r1 `smallerThan` r2 then r2 else r1
-        intY = if r3 `smallerThan` r4 then r3 else r4
+        intY = if r3 `smallerThan` r4 then r4 else r3
         r1 = boundHom (bihomSubstituteX bh ix) y
         r2 = boundHom (bihomSubstituteX bh sx) y
         r3 = boundHom (bihomSubstituteY bh iy) x
@@ -220,6 +221,19 @@
                               else
                                 let bh' = bihomAbsorbY bh y in bihom bh' (CF (x:xs)) (CF ys)
 
+homchain :: [Hom Integer] -> CF
+homchain (h:h':hs) = case quotEmit h of
+                     Just n ->  CF $ n : rest
+                       where (CF rest) = homchain ((homEmit h n):h':hs)
+                     Nothing -> homchain ((h `mult` h'):hs)
+  where quotEmit (n0, n1,
+                  d0, d1) = if d0 /= 0 && d1 /= 0 && n0 `quot` d0 == n1 `quot` d1 then Just $ n0 `quot` d0 else Nothing
+        mult (n0, n1,
+              d0, d1)
+             (n0', n1',
+              d0', d1') =(n0*n0' + n1*d0', n0*n1' + n1*d1',
+                          d0*n0' + d1*d0', d0*n1' + d1*d1')
+
 instance Num CF where
   (+) = bihom (0, 1, 1, 0,
                0, 0, 0, 1)
@@ -297,17 +311,26 @@
 cfcf = hom (1, 0, 0, 1)
 
 instance Floating CF where
+  pi = homchain ((0,4,1,0) : map go [1..])
+    where go n = (2*n-1, n^2,
+                  1,     0)
+
+  exp r | r < -1 || r > 1 = (exp (r / 2))^2
   exp r = cfcf (CF $ 1 : concatMap go [0..])
     where go n = [fromInteger (4*n+1) / r,
                   -2,
                   -fromInteger (4*n+3) / r,
                   2]
 
-  -- TODO: restrict range
+  log r | r < 0.5 = log (2 * r) - log 2
+  log r | r > 2   = log (r / 2) + log 2
   log r = cfcf (CF $ 0 : concatMap go [0..])
     where go n = [fromInteger (2*n+1) / (r-1),
                   fromRational $ 2 % (n+1)]
 
+  tan r | r < -1 || r > 1 = bihom ( 0,1,1,0,
+                                   -1,0,0,1) tanhalf tanhalf
+    where tanhalf = tan (r / 2)
   tan r = cfcf (CF $ 0 : concatMap go [0..])
     where go n = [fromInteger (4*n+1) / r,
                   -fromInteger (4*n+3) / r]
diff --git a/src/Math/ContinuedFraction/Simple.hs b/src/Math/ContinuedFraction/Simple.hs
--- a/src/Math/ContinuedFraction/Simple.hs
+++ b/src/Math/ContinuedFraction/Simple.hs
@@ -17,13 +17,13 @@
 
 -- Possibly output a term
 homEmittable :: Hom -> Maybe Integer
-homEmittable (a, b,
-              c, d) = if c /= 0 && d /= 0 && r == s then
+homEmittable (n0, n1,
+              d0, d1) = if d0 /= 0 && d1 /= 0 && r == s then
                         Just r
                       else
                         Nothing
-  where r = a `quot` c
-        s = b `quot` d
+  where r = n0 `quot` d0
+        s = n1 `quot` d1
 
 homEmit :: Hom -> Integer -> Hom
 homEmit (n0, n1,
@@ -52,13 +52,13 @@
               Integer, Integer, Integer, Integer)
 
 bihomEmittable :: Bihom -> Maybe Integer
-bihomEmittable (a, b, c, d,
-                e, f, g, h) = if e /= 0 && f /= 0 && g /= 0 && h /= 0 && ratiosAgree then
+bihomEmittable (n0, n1, n2, n3,
+                d0, d1, d2, d3) = if d0 /= 0 && d1 /= 0 && d2 /= 0 && d3 /= 0 && ratiosAgree then
                                 Just r
                               else
                                 Nothing
-  where r = a `quot` e
-        ratiosAgree = r == b `quot` f && r == c `quot` g && r == d `quot` h
+  where r = n0 `quot` d0
+        ratiosAgree = r == n1 `quot` d1 && r == n2 `quot` d2 && r == n3 `quot` d3
 
 bihomEmit :: Bihom -> Integer -> Bihom
 bihomEmit (n0, n1, n2, n3,
