Kaydet (Commit) eba99dfd authored tarafından Raymond Hettinger's avatar Raymond Hettinger

Issue 3412: Mention fractions and decimal in the tutorial section on floating point.

üst 9fce0ba9
...@@ -135,6 +135,14 @@ display of your final results to the number of decimal digits you expect. ...@@ -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` :func:`str` usually suffices, and for finer control see the :meth:`str.format`
method's format specifiers in :ref:`formatstrings`. 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 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 at the Numerical Python package and many other packages for mathematical and
statistical operations supplied by the SciPy project. See <http://scipy.org>. statistical operations supplied by the SciPy project. See <http://scipy.org>.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment