diff --git a/CHANGES b/CHANGES
new file mode 100644
--- /dev/null
+++ b/CHANGES
@@ -0,0 +1,5 @@
+0.1.1
+=====
+
+Added a few complex functions and mkComplex_e
+
diff --git a/hmatrix-special.cabal b/hmatrix-special.cabal
--- a/hmatrix-special.cabal
+++ b/hmatrix-special.cabal
@@ -1,5 +1,5 @@
 Name:               hmatrix-special
-Version:            0.1.0
+Version:            0.1.1
 License:            GPL
 License-file:       LICENSE
 Author:             Alberto Ruiz
@@ -11,14 +11,15 @@
  Interface to GSL special functions.
 
 Category:           Math
-tested-with:        GHC ==6.10.4
+tested-with:        GHC ==6.12.3
 
-cabal-version:      >=1.2
+cabal-version:      >=1.6
 build-type:         Simple
 
 extra-source-files: lib/Numeric/GSL/Special/auto.hs,
                     lib/Numeric/GSL/Special/autoall.sh,
-                    lib/Numeric/GSL/Special/replace.hs
+                    lib/Numeric/GSL/Special/replace.hs,
+                    CHANGES
 
 flag safe-cheap
     description:    use slower non-blocking "safe" foreign calls
@@ -71,4 +72,8 @@
         cpp-options: -DSAFE_CHEAP=safe
     else
         cpp-options: -DSAFE_CHEAP=unsafe
+
+source-repository head
+    type:     darcs
+    location: http://code.haskell.org/hmatrix
 
diff --git a/lib/Numeric/GSL/Special.hs b/lib/Numeric/GSL/Special.hs
--- a/lib/Numeric/GSL/Special.hs
+++ b/lib/Numeric/GSL/Special.hs
@@ -15,6 +15,7 @@
 -----------------------------------------------------------------------------
 
 module Numeric.GSL.Special (
+  -- * Functions
   module Numeric.GSL.Special.Airy
 , module Numeric.GSL.Special.Bessel
 , module Numeric.GSL.Special.Clausen
@@ -43,9 +44,12 @@
 , module Numeric.GSL.Special.Transport
 , module Numeric.GSL.Special.Trig
 , module Numeric.GSL.Special.Zeta
+-- * Util
+, mkComplex_e
 )
 where
 
+
 import Numeric.GSL.Special.Airy
 import Numeric.GSL.Special.Bessel
 import Numeric.GSL.Special.Clausen
@@ -74,3 +78,31 @@
 import Numeric.GSL.Special.Transport
 import Numeric.GSL.Special.Trig
 import Numeric.GSL.Special.Zeta
+
+import Data.Complex
+
+----------------------------------------------------------------
+
+{- | Some GSL complex functions work with separate real and imaginary parts stored in real variables, obtaining tuples (value, error) for the real and imaginary parts of the result:
+
+> > import Numeric.GSL.Special.Dilog
+
+> > complex_dilog_xy_e 1 1
+> ((0.6168502750680847,1.1097853812294034e-14),(1.4603621167531193,1.1855504863267322e-14))
+
+We can use @mkComplex_e@ to work with \"normal\" complex numbers:
+
+> > import Numeric.GSL.Special(mkComplex_e)
+> > import Data.Complex
+
+> > let dilogC = fst . mkComplex_e complex_dilog_xy_e
+
+> > dilogC (1 :+ 1)
+> 0.6168502750680847 :+ 1.4603621167531193
+
+-}
+mkComplex_e :: (Double -> Double -> ((Double, Double), (Double, Double)))
+            -> Complex Double -> (Complex Double, Complex Double)
+mkComplex_e f (x :+ y) = (zr :+ zi, er :+ ei)
+    where ((zr,er),(zi,ei)) = f x y
+
diff --git a/lib/Numeric/GSL/Special/Dilog.hs b/lib/Numeric/GSL/Special/Dilog.hs
--- a/lib/Numeric/GSL/Special/Dilog.hs
+++ b/lib/Numeric/GSL/Special/Dilog.hs
@@ -15,6 +15,9 @@
 module Numeric.GSL.Special.Dilog(
   dilog_e
 , dilog
+, complex_dilog_xy_e
+, complex_dilog_e
+, complex_spence_xy_e
 ) where
 
 import Foreign(Ptr)
@@ -29,14 +32,14 @@
 dilog = gsl_sf_dilog
 foreign import ccall SAFE_CHEAP "gsl_sf_dilog" gsl_sf_dilog :: Double -> Double
 
-complex_dilog_xy_e :: Double -> Double -> Ptr () -> (Double,Double)
-complex_dilog_xy_e x y result_re = createSFR "complex_dilog_xy_e" $ gsl_sf_complex_dilog_xy_e x y result_re
+complex_dilog_xy_e :: Double -> Double -> ((Double,Double),(Double,Double))
+complex_dilog_xy_e x y = create2SFR "complex_dilog_xy_e" $ gsl_sf_complex_dilog_xy_e x y
 foreign import ccall SAFE_CHEAP "gsl_sf_complex_dilog_xy_e" gsl_sf_complex_dilog_xy_e :: Double -> Double -> Ptr () -> Ptr () -> IO CInt
 
-complex_dilog_e :: Double -> Double -> Ptr () -> (Double,Double)
-complex_dilog_e r theta result_re = createSFR "complex_dilog_e" $ gsl_sf_complex_dilog_e r theta result_re
+complex_dilog_e :: Double -> Double -> ((Double,Double),(Double,Double))
+complex_dilog_e r theta = create2SFR "complex_dilog_e" $ gsl_sf_complex_dilog_e r theta
 foreign import ccall SAFE_CHEAP "gsl_sf_complex_dilog_e" gsl_sf_complex_dilog_e :: Double -> Double -> Ptr () -> Ptr () -> IO CInt
 
-complex_spence_xy_e :: Double -> Double -> Ptr () -> (Double,Double)
-complex_spence_xy_e x y real_sp = createSFR "complex_spence_xy_e" $ gsl_sf_complex_spence_xy_e x y real_sp
+complex_spence_xy_e :: Double -> Double -> ((Double,Double),(Double,Double))
+complex_spence_xy_e x y = create2SFR "complex_spence_xy_e" $ gsl_sf_complex_spence_xy_e x y
 foreign import ccall SAFE_CHEAP "gsl_sf_complex_spence_xy_e" gsl_sf_complex_spence_xy_e :: Double -> Double -> Ptr () -> Ptr () -> IO CInt
diff --git a/lib/Numeric/GSL/Special/Gamma.hs b/lib/Numeric/GSL/Special/Gamma.hs
--- a/lib/Numeric/GSL/Special/Gamma.hs
+++ b/lib/Numeric/GSL/Special/Gamma.hs
@@ -21,6 +21,7 @@
 , gammastar
 , gammainv_e
 , gammainv
+, lngamma_complex_e
 , taylorcoeff_e
 , taylorcoeff
 , fact_e
@@ -95,8 +96,8 @@
 gammainv = gsl_sf_gammainv
 foreign import ccall SAFE_CHEAP "gsl_sf_gammainv" gsl_sf_gammainv :: Double -> Double
 
-lngamma_complex_e :: Double -> Double -> Ptr () -> (Double,Double)
-lngamma_complex_e zr zi lnr = createSFR "lngamma_complex_e" $ gsl_sf_lngamma_complex_e zr zi lnr
+lngamma_complex_e :: Double -> Double -> ((Double,Double),(Double,Double))
+lngamma_complex_e zr zi = create2SFR "lngamma_complex_e" $ gsl_sf_lngamma_complex_e zr zi
 foreign import ccall SAFE_CHEAP "gsl_sf_lngamma_complex_e" gsl_sf_lngamma_complex_e :: Double -> Double -> Ptr () -> Ptr () -> IO CInt
 
 taylorcoeff_e :: CInt -> Double -> (Double,Double)
diff --git a/lib/Numeric/GSL/Special/Internal.hsc b/lib/Numeric/GSL/Special/Internal.hsc
--- a/lib/Numeric/GSL/Special/Internal.hsc
+++ b/lib/Numeric/GSL/Special/Internal.hsc
@@ -20,6 +20,7 @@
 
 module Numeric.GSL.Special.Internal (
     createSFR,
+    create2SFR,
     createSFR_E10,
     Precision(..),
     Gsl_mode_t,
@@ -32,7 +33,6 @@
 import Data.Packed.Development(check,(//))
 import Foreign.C.Types(CSize,CInt)
 
-
 data Precision = PrecDouble | PrecSingle | PrecApprox
 
 precCode :: Precision -> Int
@@ -79,7 +79,7 @@
 
 
 ----------------------------------------------------------------
--- | access to a sf_result
+-- | access to one sf_result
 createSFR :: String -> (Ptr a -> IO CInt) -> (Double, Double)
 createSFR s f = unsafePerformIO $ do
     p <- malloc :: IO (Ptr Gsl_sf_result)
@@ -88,6 +88,18 @@
     free p
     return (val,err)
 
+----------------------------------------------------------------
+-- | access to two sf_result's
+create2SFR :: String -> (Ptr a -> Ptr a -> IO CInt) -> ((Double, Double),(Double, Double))
+create2SFR s f = unsafePerformIO $ do
+    p1 <- malloc :: IO (Ptr Gsl_sf_result)
+    p2 <- malloc :: IO (Ptr Gsl_sf_result)
+    f (castPtr p1) (castPtr p2) // check s
+    SF val1 err1 <- peek p1
+    SF val2 err2 <- peek p2
+    free p1
+    free p2
+    return ((val1,err1),(val2,err2))
 
 ---------------------------------------------------------------------
 -- the sf_result_e10 contains two doubles and the exponent
diff --git a/lib/Numeric/GSL/Special/Log.hs b/lib/Numeric/GSL/Special/Log.hs
--- a/lib/Numeric/GSL/Special/Log.hs
+++ b/lib/Numeric/GSL/Special/Log.hs
@@ -17,6 +17,7 @@
 , Numeric.GSL.Special.Log.log
 , log_abs_e
 , log_abs
+, complex_log_e
 , log_1plusx_e
 , log_1plusx
 , log_1plusx_mx_e
@@ -43,8 +44,8 @@
 log_abs = gsl_sf_log_abs
 foreign import ccall SAFE_CHEAP "gsl_sf_log_abs" gsl_sf_log_abs :: Double -> Double
 
-complex_log_e :: Double -> Double -> Ptr () -> (Double,Double)
-complex_log_e zr zi lnr = createSFR "complex_log_e" $ gsl_sf_complex_log_e zr zi lnr
+complex_log_e :: Double -> Double -> ((Double,Double),(Double,Double))
+complex_log_e zr zi = create2SFR "complex_log_e" $ gsl_sf_complex_log_e zr zi
 foreign import ccall SAFE_CHEAP "gsl_sf_complex_log_e" gsl_sf_complex_log_e :: Double -> Double -> Ptr () -> Ptr () -> IO CInt
 
 log_1plusx_e :: Double -> (Double,Double)
diff --git a/lib/Numeric/GSL/Special/Psi.hs b/lib/Numeric/GSL/Special/Psi.hs
--- a/lib/Numeric/GSL/Special/Psi.hs
+++ b/lib/Numeric/GSL/Special/Psi.hs
@@ -19,6 +19,7 @@
 , psi
 , psi_1piy_e
 , psi_1piy
+, complex_psi_e
 , psi_1_int_e
 , psi_1_int
 , psi_1_e
@@ -55,8 +56,8 @@
 psi_1piy = gsl_sf_psi_1piy
 foreign import ccall SAFE_CHEAP "gsl_sf_psi_1piy" gsl_sf_psi_1piy :: Double -> Double
 
-complex_psi_e :: Double -> Double -> Ptr () -> (Double,Double)
-complex_psi_e x y result_re = createSFR "complex_psi_e" $ gsl_sf_complex_psi_e x y result_re
+complex_psi_e :: Double -> Double -> ((Double,Double),(Double,Double))
+complex_psi_e x y = create2SFR "complex_psi_e" $ gsl_sf_complex_psi_e x y
 foreign import ccall SAFE_CHEAP "gsl_sf_complex_psi_e" gsl_sf_complex_psi_e :: Double -> Double -> Ptr () -> Ptr () -> IO CInt
 
 psi_1_int_e :: CInt -> (Double,Double)
diff --git a/lib/Numeric/GSL/Special/Trig.hs b/lib/Numeric/GSL/Special/Trig.hs
--- a/lib/Numeric/GSL/Special/Trig.hs
+++ b/lib/Numeric/GSL/Special/Trig.hs
@@ -19,12 +19,17 @@
 , Numeric.GSL.Special.Trig.cos
 , hypot_e
 , hypot
+, complex_sin_e
+, complex_cos_e
+, complex_logsin_e
 , sinc_e
 , sinc
 , lnsinh_e
 , lnsinh
 , lncosh_e
 , lncosh
+, polar_to_rect
+, rect_to_polar
 , sin_err_e
 , cos_err_e
 , angle_restrict_symm
@@ -61,16 +66,16 @@
 hypot = gsl_sf_hypot
 foreign import ccall SAFE_CHEAP "gsl_sf_hypot" gsl_sf_hypot :: Double -> Double -> Double
 
-complex_sin_e :: Double -> Double -> Ptr () -> (Double,Double)
-complex_sin_e zr zi szr = createSFR "complex_sin_e" $ gsl_sf_complex_sin_e zr zi szr
+complex_sin_e :: Double -> Double -> ((Double,Double),(Double,Double))
+complex_sin_e zr zi = create2SFR "complex_sin_e" $ gsl_sf_complex_sin_e zr zi
 foreign import ccall SAFE_CHEAP "gsl_sf_complex_sin_e" gsl_sf_complex_sin_e :: Double -> Double -> Ptr () -> Ptr () -> IO CInt
 
-complex_cos_e :: Double -> Double -> Ptr () -> (Double,Double)
-complex_cos_e zr zi czr = createSFR "complex_cos_e" $ gsl_sf_complex_cos_e zr zi czr
+complex_cos_e :: Double -> Double -> ((Double,Double),(Double,Double))
+complex_cos_e zr zi = create2SFR "complex_cos_e" $ gsl_sf_complex_cos_e zr zi
 foreign import ccall SAFE_CHEAP "gsl_sf_complex_cos_e" gsl_sf_complex_cos_e :: Double -> Double -> Ptr () -> Ptr () -> IO CInt
 
-complex_logsin_e :: Double -> Double -> Ptr () -> (Double,Double)
-complex_logsin_e zr zi lszr = createSFR "complex_logsin_e" $ gsl_sf_complex_logsin_e zr zi lszr
+complex_logsin_e :: Double -> Double -> ((Double,Double),(Double,Double))
+complex_logsin_e zr zi = create2SFR "complex_logsin_e" $ gsl_sf_complex_logsin_e zr zi
 foreign import ccall SAFE_CHEAP "gsl_sf_complex_logsin_e" gsl_sf_complex_logsin_e :: Double -> Double -> Ptr () -> Ptr () -> IO CInt
 
 sinc_e :: Double -> (Double,Double)
@@ -97,12 +102,12 @@
 lncosh = gsl_sf_lncosh
 foreign import ccall SAFE_CHEAP "gsl_sf_lncosh" gsl_sf_lncosh :: Double -> Double
 
-polar_to_rect :: Double -> Double -> Ptr () -> (Double,Double)
-polar_to_rect r theta x = createSFR "polar_to_rect" $ gsl_sf_polar_to_rect r theta x
+polar_to_rect :: Double -> Double -> ((Double,Double),(Double,Double))
+polar_to_rect r theta = create2SFR "polar_to_rect" $ gsl_sf_polar_to_rect r theta
 foreign import ccall SAFE_CHEAP "gsl_sf_polar_to_rect" gsl_sf_polar_to_rect :: Double -> Double -> Ptr () -> Ptr () -> IO CInt
 
-rect_to_polar :: Double -> Double -> Ptr () -> (Double,Double)
-rect_to_polar x y r = createSFR "rect_to_polar" $ gsl_sf_rect_to_polar x y r
+rect_to_polar :: Double -> Double -> ((Double,Double),(Double,Double))
+rect_to_polar x y = create2SFR "rect_to_polar" $ gsl_sf_rect_to_polar x y
 foreign import ccall SAFE_CHEAP "gsl_sf_rect_to_polar" gsl_sf_rect_to_polar :: Double -> Double -> Ptr () -> Ptr () -> IO CInt
 
 sin_err_e :: Double -> Double -> (Double,Double)
diff --git a/lib/Numeric/GSL/Special/auto.hs b/lib/Numeric/GSL/Special/auto.hs
--- a/lib/Numeric/GSL/Special/auto.hs
+++ b/lib/Numeric/GSL/Special/auto.hs
@@ -31,7 +31,8 @@
 
 
 safe (Header _ _ args) =  all ok args 
-                         || all ok (init args) && kn (last args)
+                       || all ok (init args) && kn (last args)
+                       || length args >= 2 && all ok (init (init args)) && kn (last args) && kn (last (init args))
     where ok ((Normal s),_) | s `elem` ["double","float","int","gsl_mode_t"] = True
           ok _ = False
           kn ((Pointer "gsl_sf_result"),_) = True
@@ -206,7 +207,9 @@
 fixmd1 = rep ("Gsl_mode_t","Precision")
 fixmd2 = rep ("mode"," (precCode mode)")
 
-boiler h@(Header t n args) | fst (last args) == Pointer "gsl_sf_result" = boilerResult h
+boiler h@(Header t n args) |    fst (last args)        == Pointer "gsl_sf_result" 
+                             && fst (last (init args)) == Pointer "gsl_sf_result" = boiler2Results h
+                           | fst (last args) == Pointer "gsl_sf_result" = boilerResult h
                            | fst (last args) == Pointer "gsl_sf_result_e10" = boilerResultE10 h
                            | any isMode args = boilerMode h
                            | otherwise = boilerBasic h
@@ -223,6 +226,11 @@
      hName n ++ " "++ initArgs args ++
        " = createSFR \""++ hName n ++"\" $ " ++ n ++ " "++ (fixmd2 $ initArgs args)
 
+boiler2Results h@(Header t n args) =
+    hName n++" :: "++ (fixmd1 $ concat $ intersperse" -> "$ map showHa (init (init args))) ++" -> " ++ "((Double,Double),(Double,Double))\n" ++
+     hName n ++ " "++ init2Args args ++
+       " = create2SFR \""++ hName n ++"\" $ " ++ n ++ " "++ (fixmd2 $ init2Args args)
+
 boilerResultE10 h@(Header t n args) =
     hName n++" :: "++ (fixmd1 $ concat $ intersperse" -> "$ map showHa (init args)) ++" -> " ++ "(Double,Int,Double)\n" ++
      hName n ++ " "++ initArgs args ++
@@ -242,3 +250,5 @@
 
 allArgs args =  unwords (map (cVar.snd) args)
 initArgs args = unwords (map (cVar.snd) (init args))
+init2Args args = unwords (map (cVar.snd) (init $ init args))
+
