diff --git a/exact-real.cabal b/exact-real.cabal
--- a/exact-real.cabal
+++ b/exact-real.cabal
@@ -1,5 +1,5 @@
 name:                exact-real
-version:             0.3.0.0
+version:             0.4.0.0
 synopsis:            Exact real arithmetic
 description:         please see readme.md
 license:             MIT
diff --git a/src/Data/CReal/Internal.hs b/src/Data/CReal/Internal.hs
--- a/src/Data/CReal/Internal.hs
+++ b/src/Data/CReal/Internal.hs
@@ -303,18 +303,17 @@
 -- | @rationalToDecimal p x@ returns a string representing @x@ at @p@ decimal
 -- places.
 rationalToDecimal :: Int -> Rational -> String
-rationalToDecimal places r = s
-  where ds = show ((numerator r * 10^places) /. denominator r)
-        (is, fs) = splitAt (length ds - places) ds
-        is' = case is of
-                ""  -> "0"
-                "-" -> "-0"
-                _   -> is
-        suff = case places of
-                 0 -> ""
-                 _ -> '.' : take places (fs ++ repeat '0')
-        s = is' ++ suff
+rationalToDecimal places r = p ++ is ++ if places > 0 then "." ++ fs else ""
+  where r' = abs r
+        p = case signum r of
+              -1 -> "-"
+              _  -> ""
+        ds = show ((numerator r' * 10^places) /. denominator r')
+        l = length ds
+        (is, fs) = if | l <= places -> ("0", replicate (places - l) '0' ++ ds)
+                      | otherwise -> splitAt (length ds - places) ds
 
+
 --
 -- Integer operations
 --
@@ -369,7 +368,7 @@
 -- | Apply 'negate' to every other element, starting with the second
 --
 -- >>> alternateSign [1..5]
--- [1, -2, 3, -4, 5]
+-- [1,-2,3,-4,5]
 alternateSign :: Num a => [a] -> [a]
 alternateSign = zipWith ($) (cycle [id, negate])
 
diff --git a/test/Test.hs b/test/Test.hs
--- a/test/Test.hs
+++ b/test/Test.hs
@@ -45,6 +45,11 @@
 prop_shiftR :: CReal Precision -> Int -> Property
 prop_shiftR x s = x `shiftR` s === x / 2 ** fromIntegral s
 
+prop_showNumDigits :: Positive Int -> Rational -> Property
+prop_showNumDigits (Positive places) x =
+  let s = rationalToDecimal places x
+  in length (dropWhile (/= '.') s) === places + 1
+
 main :: IO ()
 main = $(defaultMainGenerator)
 
