@@ -179,7 +179,7 @@ \subsection{Quick-start Tutorial \label{decimal-tutorial}}
179179'1.34'
180180>>> float(a)
1811811.3400000000000001
182- >>> round(a, 1)
182+ >>> round(a, 1) # round() first converts to binary floating point
1831831.3
184184>>> int(a)
1851851
@@ -217,9 +217,6 @@ \subsection{Quick-start Tutorial \label{decimal-tutorial}}
217217
218218\begin {verbatim }
219219>>> myothercontext = Context(prec=60, rounding=ROUND_HALF_DOWN)
220- >>> myothercontext
221- Context(prec=60, rounding=ROUND_HALF_DOWN, Emin=-999999999, Emax=999999999,
222- capitals=1, flags=[], traps=[])
223220>>> setcontext(myothercontext)
224221>>> Decimal(1) / Decimal(7)
225222Decimal("0.142857142857142857142857142857142857142857142857142857142857")
@@ -855,10 +852,13 @@ \subsection{Working with threads \label{decimal-threads}}
855852
856853\begin {verbatim }
857854# Set applicationwide defaults for all threads about to be launched
858- DefaultContext = Context(prec=12, rounding=ROUND_DOWN, traps=[InvalidOperation])
855+ DefaultContext.prec = 12
856+ DefaultContext.rounding = ROUND_DOWN
857+ DefaultContext.traps = ExtendedContext.traps.copy()
858+ DefaultContext.traps[InvalidOperation] = 1
859859setcontext(DefaultContext)
860860
861- # Afterward , the threads can be started
861+ # Afterwards , the threads can be started
862862t1.start()
863863t2.start()
864864t3.start()
0 commit comments