mirror of
https://github.com/python/cpython.git
synced 2025-12-15 21:44:50 +00:00
Merged revisions 63655 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r63655 | benjamin.peterson | 2008-05-25 19:54:22 -0500 (Sun, 25 May 2008) | 2 lines update the tutorial to use str.format ........
This commit is contained in:
parent
dc6c16ac63
commit
e6f00637be
7 changed files with 84 additions and 34 deletions
|
|
@ -132,9 +132,8 @@ that every float operation can suffer a new rounding error.
|
|||
While pathological cases do exist, for most casual use of floating-point
|
||||
arithmetic you'll see the result you expect in the end if you simply round the
|
||||
display of your final results to the number of decimal digits you expect.
|
||||
:func:`str` usually suffices, and for finer control see the discussion of
|
||||
Python's ``%`` format operator: the ``%g``, ``%f`` and ``%e`` format codes
|
||||
supply flexible and easy ways to round float results for display.
|
||||
:func:`str` usually suffices, and for finer control see the :meth:`str.format`
|
||||
method's format specifiers in :ref:`formatstrings`.
|
||||
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue