Index: django/template/defaultfilters.py
===================================================================
--- django/template/defaultfilters.py	(revision 4053)
+++ django/template/defaultfilters.py	(working copy)
@@ -27,20 +27,16 @@
     from django.utils.html import fix_ampersands
     return fix_ampersands(value)
 
-def floatformat(text):
+def floatformat(text, precision=1):
     """
-    Displays a floating point number as 34.2 (with one decimal place) -- but
-    only if there's a point to be displayed
+    Rounds a floating point number to the number of decimal places given in the
+    argument, with trailing zeroes and periods stripped.
     """
     try:
         f = float(text)
     except ValueError:
         return ''
-    m = f - int(f)
-    if m:
-        return '%.1f' % f
-    else:
-        return '%d' % int(f)
+    return re.sub(r'\.?0+$', '', ('%%.%sf' % precision) % f)
 
 def linenumbers(value):
     "Displays text with line numbers"
Index: docs/templates.txt
===================================================================
--- docs/templates.txt	(revision 4053)
+++ docs/templates.txt	(working copy)
@@ -924,13 +924,16 @@
 floatformat
 ~~~~~~~~~~~
 
-Rounds a floating-point number to one decimal place -- but only if there's a
-decimal part to be displayed. For example:
+Rounds a floating-point number to the number of decimal places given in the
+argument (the dafault is 1), with trailing zeroes and periods stripped.
 
-    * ``36.123`` gets converted to ``36.1``
-    * ``36.15`` gets converted to ``36.2``
-    * ``36`` gets converted to ``36``
+Example:
 
+    * ``{{ "36.12345"|floatformat:2 }}`` displays ``36.12``
+    * ``{{ "36.123"|floatformat }}`` displays ``36.1``
+    * ``{{ "36.15"|floatformat }}`` displays ``36.2``
+    * ``{{ "36"|floatformat }}`` displays ``36``
+
 get_digit
 ~~~~~~~~~
 
