Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #14403 -- Provided some extra resources on the difference betwe…

…en FloatField and DecimalField in the model field reference. Thanks to typeshige for the report and trebor74hr and dmedvinsky for the draft patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15090 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 7f3210efa8b4bfb34a3feebae7bb08c26f4a65a7 1 parent cd977b9
authored December 29, 2010

Showing 1 changed file with 20 additions and 0 deletions. Show diff stats Hide diff stats

  1. 20  docs/ref/models/fields.txt
20  docs/ref/models/fields.txt
@@ -455,6 +455,12 @@ decimal places::
455 455
 
456 456
 The admin represents this as an ``<input type="text">`` (a single-line input).
457 457
 
  458
+.. note::
  459
+
  460
+    For more information about the differences between the
  461
+    :class:`FloatField` and :class:`DecimalField` classes, please
  462
+    see :ref:`FloatField vs. DecimalField <floatfield_vs_decimalfield>`. 
  463
+
458 464
 ``EmailField``
459 465
 --------------
460 466
 
@@ -661,6 +667,20 @@ A floating-point number represented in Python by a ``float`` instance.
661 667
 
662 668
 The admin represents this as an ``<input type="text">`` (a single-line input).
663 669
 
  670
+.. _floatfield_vs_decimalfield:
  671
+
  672
+.. admonition:: ``FloatField`` vs. ``DecimalField``
  673
+
  674
+    The :class:`FloatField` class is sometimes mixed up with the
  675
+    :class:`DecimalField` class. Although they both represent real numbers, they
  676
+    represent those numbers differently. ``FloatField`` uses Python's ``float``
  677
+    type internally, while ``DecimalField`` uses Python's ``Decimal`` type. For
  678
+    information on the difference between the two, see Python's documentation on
  679
+    `Decimal fixed point and floating point arithmetic`_.
  680
+
  681
+.. _Decimal fixed point and floating point arithmetic: http://docs.python.org/library/decimal.html
  682
+
  683
+
664 684
 ``ImageField``
665 685
 --------------
666 686
 

0 notes on commit 7f3210e

Please sign in to comment.
Something went wrong with that request. Please try again.