@@ -82,7 +82,7 @@ values share the same approximation, any one of them could be displayed
8282while still preserving the invariant ``eval(repr(x)) == x ``.
8383
8484Historically, the Python prompt and built-in :func: `repr ` function would chose
85- the one with 17 significant digits, ``0.10000000000000001 ``, Starting with
85+ the one with 17 significant digits, ``0.10000000000000001 ``. Starting with
8686Python 3.1, Python (on most systems) is now able to choose the shortest of
8787these and simply display ``0.1 ``.
8888
@@ -123,9 +123,9 @@ Also, since the 0.1 cannot get any closer to the exact value of 1/10 and
123123
124124Though the numbers cannot be made closer to their intended exact values,
125125the :func: `round ` function can be useful for post-rounding so that results
126- have inexact values that are comparable to one another::
126+ with inexact values become comparable to one another::
127127
128- >>> round(.1 + .1 + .1, 1 ) == round(.3, 1 )
128+ >>> round(.1 + .1 + .1, 10 ) == round(.3, 10 )
129129 True
130130
131131Binary floating-point arithmetic holds many surprises like this. The problem
@@ -137,7 +137,7 @@ As that says near the end, "there are no easy answers." Still, don't be unduly
137137wary of floating-point! The errors in Python float operations are inherited
138138from the floating-point hardware, and on most machines are on the order of no
139139more than 1 part in 2\*\* 53 per operation. That's more than adequate for most
140- tasks, but you do need to keep in mind that it's not decimal arithmetic, and
140+ tasks, but you do need to keep in mind that it's not decimal arithmetic and
141141that every float operation can suffer a new rounding error.
142142
143143While pathological cases do exist, for most casual use of floating-point
@@ -165,7 +165,7 @@ fraction::
165165
166166 >>> x = 3.14159
167167 >>> x.as_integer_ratio()
168- (3537115888337719L, 1125899906842624L )
168+ (3537115888337719, 1125899906842624 )
169169
170170Since the ratio is exact, it can be used to losslessly recreate the
171171original value::
0 commit comments