[Python-checkins] r73637 - in python/branches/release31-maint: Doc/library/math.rst Doc/library/sqlite3.rst Doc/library/turtle.rst Doc/tutorial/inputoutput.rst Doc/tutorial/introduction.rst Doc/tutorial/stdlib2.rst

mark.dickinson python-checkins at python.org
Sun Jun 28 23:00:42 CEST 2009


Author: mark.dickinson
Date: Sun Jun 28 23:00:42 2009
New Revision: 73637

Log:
Merged revisions 73636 via svnmerge from 
svn+ssh://pythondev@www.python.org/python/branches/py3k

........
  r73636 | mark.dickinson | 2009-06-28 21:59:42 +0100 (Sun, 28 Jun 2009) | 2 lines
  
  Issue #6354: More fixes for code examples involving the repr of a float.
........


Modified:
   python/branches/release31-maint/   (props changed)
   python/branches/release31-maint/Doc/library/math.rst
   python/branches/release31-maint/Doc/library/sqlite3.rst
   python/branches/release31-maint/Doc/library/turtle.rst
   python/branches/release31-maint/Doc/tutorial/inputoutput.rst
   python/branches/release31-maint/Doc/tutorial/introduction.rst
   python/branches/release31-maint/Doc/tutorial/stdlib2.rst

Modified: python/branches/release31-maint/Doc/library/math.rst
==============================================================================
--- python/branches/release31-maint/Doc/library/math.rst	(original)
+++ python/branches/release31-maint/Doc/library/math.rst	Sun Jun 28 23:00:42 2009
@@ -82,7 +82,7 @@
    loss of precision by tracking multiple intermediate partial sums::
 
         >>> sum([.1, .1, .1, .1, .1, .1, .1, .1, .1, .1])
-        0.99999999999999989
+        0.9999999999999999
         >>> fsum([.1, .1, .1, .1, .1, .1, .1, .1, .1, .1])
         1.0
 

Modified: python/branches/release31-maint/Doc/library/sqlite3.rst
==============================================================================
--- python/branches/release31-maint/Doc/library/sqlite3.rst	(original)
+++ python/branches/release31-maint/Doc/library/sqlite3.rst	Sun Jun 28 23:00:42 2009
@@ -81,7 +81,7 @@
    >>> for row in c:
    ...    print(row)
    ...
-   (u'2006-01-05', u'BUY', u'RHAT', 100, 35.140000000000001)
+   (u'2006-01-05', u'BUY', u'RHAT', 100, 35.14)
    (u'2006-03-28', u'BUY', u'IBM', 1000, 45.0)
    (u'2006-04-06', u'SELL', u'IBM', 500, 53.0)
    (u'2006-04-05', u'BUY', u'MSOFT', 1000, 72.0)
@@ -591,7 +591,7 @@
     >>> type(r)
     <type 'sqlite3.Row'>
     >>> r
-    (u'2006-01-05', u'BUY', u'RHAT', 100.0, 35.140000000000001)
+    (u'2006-01-05', u'BUY', u'RHAT', 100.0, 35.14)
     >>> len(r)
     5
     >>> r[2]

Modified: python/branches/release31-maint/Doc/library/turtle.rst
==============================================================================
--- python/branches/release31-maint/Doc/library/turtle.rst	(original)
+++ python/branches/release31-maint/Doc/library/turtle.rst	Sun Jun 28 23:00:42 2009
@@ -881,7 +881,7 @@
        >>> tup = (0.2, 0.8, 0.55)
        >>> turtle.pencolor(tup)
        >>> turtle.pencolor()
-       (0.20000000000000001, 0.80000000000000004, 0.5490196078431373)
+       (0.2, 0.8, 0.5490196078431373)
        >>> colormode(255)
        >>> turtle.pencolor()
        (51, 204, 140)

Modified: python/branches/release31-maint/Doc/tutorial/inputoutput.rst
==============================================================================
--- python/branches/release31-maint/Doc/tutorial/inputoutput.rst	(original)
+++ python/branches/release31-maint/Doc/tutorial/inputoutput.rst	Sun Jun 28 23:00:42 2009
@@ -52,10 +52,10 @@
    'Hello, world.'
    >>> repr(s)
    "'Hello, world.'"
-   >>> str(0.1)
-   '0.1'
-   >>> repr(0.1)
-   '0.10000000000000001'
+   >>> str(1.0/7.0)
+   '0.142857142857'
+   >>> repr(1.0/7.0)
+   '0.14285714285714285'
    >>> x = 10 * 3.25
    >>> y = 200 * 200
    >>> s = 'The value of x is ' + repr(x) + ', and y is ' + repr(y) + '...'

Modified: python/branches/release31-maint/Doc/tutorial/introduction.rst
==============================================================================
--- python/branches/release31-maint/Doc/tutorial/introduction.rst	(original)
+++ python/branches/release31-maint/Doc/tutorial/introduction.rst	Sun Jun 28 23:00:42 2009
@@ -56,7 +56,7 @@
    >>> (50-5*6)/4
    5.0
    >>> 8/5 # Fractions aren't lost when dividing integers
-   1.6000000000000001
+   1.6
 
 Note: You might not see exactly the same result; floating point results can
 differ from one machine to another.  We will say more later about controlling

Modified: python/branches/release31-maint/Doc/tutorial/stdlib2.rst
==============================================================================
--- python/branches/release31-maint/Doc/tutorial/stdlib2.rst	(original)
+++ python/branches/release31-maint/Doc/tutorial/stdlib2.rst	Sun Jun 28 23:00:42 2009
@@ -359,10 +359,10 @@
 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


More information about the Python-checkins mailing list