summaryrefslogtreecommitdiffstats
path: root/Doc/tutorial/stdlib2.rst
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2009-06-28 20:59:42 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2009-06-28 20:59:42 (GMT)
commit5a55b61a2aa15b94d26bbc058ee2b5433178a42e (patch)
treef3271995fbef03c8aa251164de7cf9fb63e6504a /Doc/tutorial/stdlib2.rst
parent6e6565b64b201952b0497c4915e17ace5cae04a7 (diff)
downloadcpython-5a55b61a2aa15b94d26bbc058ee2b5433178a42e.zip
cpython-5a55b61a2aa15b94d26bbc058ee2b5433178a42e.tar.gz
cpython-5a55b61a2aa15b94d26bbc058ee2b5433178a42e.tar.bz2
Issue #6354: More fixes for code examples involving the repr of a float.
Diffstat (limited to 'Doc/tutorial/stdlib2.rst')
-rw-r--r--Doc/tutorial/stdlib2.rst8
1 files changed, 4 insertions, 4 deletions
diff --git a/Doc/tutorial/stdlib2.rst b/Doc/tutorial/stdlib2.rst
index 4be3275..d17b031 100644
--- a/Doc/tutorial/stdlib2.rst
+++ b/Doc/tutorial/stdlib2.rst
@@ -359,10 +359,10 @@ results in decimal floating point and binary floating point. The difference
becomes significant if the results are rounded to the nearest cent::
>>> from decimal import *
- >>> Decimal('0.70') * Decimal('1.05')
- Decimal("0.7350")
- >>> .70 * 1.05
- 0.73499999999999999
+ >>> round(Decimal('0.70') * Decimal('1.05'), 2)
+ Decimal('0.74')
+ >>> round(.70 * 1.05, 2)
+ 0.73
The :class:`Decimal` result keeps a trailing zero, automatically inferring four
place significance from multiplicands with two place significance. Decimal