Skip to content

Commit eba99df

Browse files
committed
Issue 3412: Mention fractions and decimal in the tutorial section on floating point.
1 parent 9fce0ba commit eba99df

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Doc/tutorial/floatingpoint.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,14 @@ display of your final results to the number of decimal digits you expect.
135135
:func:`str` usually suffices, and for finer control see the :meth:`str.format`
136136
method's format specifiers in :ref:`formatstrings`.
137137

138+
For use cases which require exact decimal representation, try using the
139+
:mod:`decimal` module which implements decimal arithmetic suitable for
140+
accounting applications and high-precision applications.
141+
142+
Another form of exact arithmetic is supported by the :mod:`fractions` module
143+
which implements arithmetic based on rational numbers (so the numbers like
144+
1/3 can be represented exactly).
145+
138146
If you are a heavy user of floating point operations you should take a look
139147
at the Numerical Python package and many other packages for mathematical and
140148
statistical operations supplied by the SciPy project. See <http://scipy.org>.

0 commit comments

Comments
 (0)