diff options
author | Raymond Hettinger <python@rcn.com> | 2008-10-05 17:57:52 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2008-10-05 17:57:52 (GMT) |
commit | eba99dfde8b30e0671200b0dc52eccec91cf7cb3 (patch) | |
tree | 6d4b6cf256f3880312274256574aa9e9d6b4df3f /Doc | |
parent | 9fce0ba9e22dd4e87800f3c079e4873c0990026a (diff) | |
download | cpython-eba99dfde8b30e0671200b0dc52eccec91cf7cb3.zip cpython-eba99dfde8b30e0671200b0dc52eccec91cf7cb3.tar.gz cpython-eba99dfde8b30e0671200b0dc52eccec91cf7cb3.tar.bz2 |
Issue 3412: Mention fractions and decimal in the tutorial section on floating point.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/tutorial/floatingpoint.rst | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Doc/tutorial/floatingpoint.rst b/Doc/tutorial/floatingpoint.rst index 8816acc..a38a53e 100644 --- a/Doc/tutorial/floatingpoint.rst +++ b/Doc/tutorial/floatingpoint.rst @@ -135,6 +135,14 @@ display of your final results to the number of decimal digits you expect. :func:`str` usually suffices, and for finer control see the :meth:`str.format` method's format specifiers in :ref:`formatstrings`. +For use cases which require exact decimal representation, try using the +:mod:`decimal` module which implements decimal arithmetic suitable for +accounting applications and high-precision applications. + +Another form of exact arithmetic is supported by the :mod:`fractions` module +which implements arithmetic based on rational numbers (so the numbers like +1/3 can be represented exactly). + If you are a heavy user of floating point operations you should take a look at the Numerical Python package and many other packages for mathematical and statistical operations supplied by the SciPy project. See <http://scipy.org>. |