@@ -94,7 +94,7 @@ differentiates :const:`!-0` from :const:`!+0`.
9494The context for arithmetic is an environment specifying precision, rounding
9595rules, limits on exponents, flags indicating the results of operations, and trap
9696enablers which determine whether signals are treated as exceptions.  Rounding
97- options include :const: `~decimal. ROUND_CEILING:const: `ROUND_DOWN `,
97+ options include :const: `ROUND_CEILING `, :const: `ROUND_DOWN `,
9898:const: `ROUND_FLOOR `, :const: `ROUND_HALF_DOWN `, :const: `ROUND_HALF_EVEN `,
9999:const: `ROUND_HALF_UP `, :const: `ROUND_UP `, and :const: `ROUND_05UP `.
100100
@@ -250,7 +250,7 @@ And some mathematical functions are also available to Decimal:
250250   >>> Decimal(' 10'  
251251   Decimal('1') 
252252
253- The :meth: `~decimal. Decimal.quantize ` method rounds a number to a fixed exponent.  This method is
253+ The :meth: `~Decimal.quantize ` method rounds a number to a fixed exponent.  This method is
254254useful for monetary applications that often round results to a fixed number of
255255places:
256256
@@ -299,7 +299,7 @@ enabled:
299299Contexts also have signal flags for monitoring exceptional conditions
300300encountered during computations.  The flags remain set until explicitly cleared,
301301so it is best to clear the flags before each set of monitored computations by
302- using the :meth: `~decimal. Context.clear_flags ` method. ::
302+ using the :meth: `~Context.clear_flags ` method. ::
303303
304304   >>> setcontext(ExtendedContext) 
305305   >>> getcontext().clear_flags() 
@@ -313,8 +313,8 @@ The *flags* entry shows that the rational approximation to :const:`!Pi` was
313313rounded (digits beyond the context precision were thrown away) and that the
314314result is inexact (some of the discarded digits were non-zero).
315315
316- Individual traps are set using the dictionary in the :attr: `! traps field of a 
317- context:
316+ Individual traps are set using the dictionary in the :attr: `~Context. traps
317+ attribute of a  context:
318318
319319.. doctest :: newcontext 
320320
@@ -790,7 +790,7 @@ Decimal objects
790790      the current thread's context is used.
791791
792792      An error is returned whenever the resulting exponent is greater than
793-       :attr: `! Emax:attr:  ` ! Etiny
793+       :attr: `Emax ` or less than :meth:  ` Etiny `.
794794
795795   .. method :: radix() 
796796
@@ -892,8 +892,8 @@ Decimal objects
892892Logical operands
893893^^^^^^^^^^^^^^^^ 
894894
895- The :meth: `~decimal. Decimal.logical_and `, :meth: `~decimal. Decimal.logical_invert `, :meth: `~decimal. Decimal.logical_or `,
896- and :meth: `~decimal. Decimal.logical_xor ` methods expect their arguments to be *logical 
895+ The :meth: `~Decimal.logical_and `, :meth: `~Decimal.logical_invert `, :meth: `~Decimal.logical_or `,
896+ and :meth: `~Decimal.logical_xor ` methods expect their arguments to be *logical 
897897operands *.  A *logical operand * is a :class: `Decimal ` instance whose
898898exponent and sign are both zero, and whose digits are all either
899899:const: `!0 ` or :const: `!1 `.
@@ -1001,8 +1001,8 @@ described below. In addition, the module provides three pre-made contexts:
10011001   In single threaded environments, it is preferable to not use this context at
10021002   all.  Instead, simply create contexts explicitly as described below.
10031003
1004-    The default values are :attr: `! prec\  =\  :const: ` !28 `,
1005-    :attr: `! rounding\  =\  :const: `ROUND_HALF_EVEN `,
1004+    The default values are :attr: `Context. prec\  =\  `` 28 ` `,
1005+    :attr: `Context. rounding\  =\  :const: `ROUND_HALF_EVEN `,
10061006   and enabled traps for :class: `Overflow `, :class: `InvalidOperation `, and
10071007   :class: `DivisionByZero `.
10081008
@@ -1054,7 +1054,7 @@ In addition to the three supplied contexts, new contexts can be created with the
10541054   The :class: `Context ` class defines several general purpose methods as well as
10551055   a large number of methods for doing arithmetic directly in a given context.
10561056   In addition, for each of the :class: `Decimal ` methods described above (with
1057-    the exception of the :meth: `~decimal. Decimal.adjusted ` and :meth: `~decimal. Decimal.as_tuple ` methods) there is
1057+    the exception of the :meth: `~Decimal.adjusted ` and :meth: `~Decimal.as_tuple ` methods) there is
10581058   a corresponding :class: `Context ` method.  For example, for a :class: `Context `
10591059   instance ``C `` and :class: `Decimal ` instance ``x ``, ``C.exp(x) `` is
10601060   equivalent to ``x.exp(context=C) ``.  Each :class: `Context ` method accepts a
@@ -1570,7 +1570,7 @@ condition.
15701570   Altered an exponent to fit representation constraints.
15711571
15721572   Typically, clamping occurs when an exponent falls outside the context's
1573-    :attr: `! Emin:attr: `! Emax
1573+    :attr: `~Context. Emin:attr: `~Context. Emax
15741574   fit by adding zeros to the coefficient.
15751575
15761576
@@ -1638,7 +1638,7 @@ condition.
16381638
16391639.. class :: Subnormal 
16401640
1641-    Exponent was lower than :attr: `! Emin
1641+    Exponent was lower than :attr: `~Context. Emin
16421642
16431643   Occurs when an operation result is subnormal (the exponent is too small). If
16441644   not trapped, returns the result unchanged.
@@ -1780,8 +1780,8 @@ if either operand is a :const:`!NaN`, and return :const:`False` if this signal i
17801780not trapped.  Note that the General Decimal Arithmetic specification does not
17811781specify the behavior of direct comparisons; these rules for comparisons
17821782involving a :const: `!NaN ` were taken from the IEEE 854 standard (see Table 3 in
1783- section 5.7).  To ensure strict standards-compliance, use the :meth: `~decimal. Decimal.compare `
1784- and :meth: `~decimal. Decimal.compare_signal ` methods instead.
1783+ section 5.7).  To ensure strict standards-compliance, use the :meth: `~Decimal.compare `
1784+ and :meth: `~Decimal.compare_signal ` methods instead.
17851785
17861786The signed zeros can result from calculations that underflow. They keep the sign
17871787that would have resulted if the calculation had been carried out to greater
@@ -2013,7 +2013,7 @@ Q. In a fixed-point application with two decimal places, some inputs have many
20132013places and need to be rounded.  Others are not supposed to have excess digits
20142014and need to be validated.  What methods should be used?
20152015
2016- A. The :meth: `~decimal. Decimal.quantize ` method rounds to a fixed number of decimal places. If
2016+ A. The :meth: `~Decimal.quantize ` method rounds to a fixed number of decimal places. If
20172017the :const: `Inexact ` trap is set, it is also useful for validation:
20182018
20192019   >>> TWOPLACES  =  Decimal(10 ) **  - 2        #  same as Decimal('0.01')
@@ -2037,7 +2037,7 @@ throughout an application?
20372037A. Some operations like addition, subtraction, and multiplication by an integer
20382038will automatically preserve fixed point.  Others operations, like division and
20392039non-integer multiplication, will change the number of decimal places and need to
2040- be followed-up with a :meth: `~decimal. Decimal.quantize ` step:
2040+ be followed-up with a :meth: `~Decimal.quantize ` step:
20412041
20422042    >>> a =  Decimal(' 102.72' #  Initial fixed-point values 
20432043    >>> b =  Decimal(' 3.17'  
@@ -2053,7 +2053,7 @@ be followed-up with a :meth:`~decimal.Decimal.quantize` step:
20532053    Decimal('0.03') 
20542054
20552055In developing fixed-point applications, it is convenient to define functions
2056- to handle the :meth: `~decimal. Decimal.quantize ` step:
2056+ to handle the :meth: `~Decimal.quantize ` step:
20572057
20582058    >>> def  mul (x , y , fp = TWOPLACES ):
20592059    ...     return  (x *  y).quantize(fp)
@@ -2071,7 +2071,7 @@ Q. There are many ways to express the same value.  The numbers :const:`!200`,
20712071various precisions. Is there a way to transform them to a single recognizable
20722072canonical value?
20732073
2074- A. The :meth: `~decimal. Decimal.normalize ` method maps all equivalent values to a single
2074+ A. The :meth: `~Decimal.normalize ` method maps all equivalent values to a single
20752075representative:
20762076
20772077   >>> values =  map (Decimal, ' 200 200.000 2E2 .02E+4'  
@@ -2159,12 +2159,12 @@ for medium-sized numbers and the `Number Theoretic Transform
21592159<https://en.wikipedia.org/wiki/Discrete_Fourier_transform_(general)#Number-theoretic_transform> `_
21602160for very large numbers.
21612161
2162- The context must be adapted for exact arbitrary precision arithmetic. :attr: `! Emin
2163- and :attr: `! Emax:attr: `! clamp
2164- should always be 0 (the default).  Setting :attr: `! prec
2162+ The context must be adapted for exact arbitrary precision arithmetic. :attr: `~Context. Emin
2163+ and :attr: `~Context. Emax:attr: `~Context. clamp
2164+ should always be 0 (the default).  Setting :attr: `~Context. prec
21652165
21662166The easiest approach for trying out bignum arithmetic is to use the maximum
2167- value for :attr: `! prec# ]_::
2167+ value for :attr: `~Context. prec# ]_::
21682168
21692169    >>> setcontext(Context(prec=MAX_PREC, Emax=MAX_EMAX, Emin=MIN_EMIN)) 
21702170    >>> x = Decimal(2) ** 256 
@@ -2181,7 +2181,7 @@ the available memory will be insufficient::
21812181   MemoryError 
21822182
21832183On systems with overallocation (e.g. Linux), a more sophisticated approach is to
2184- adjust :attr: `! prec
2184+ adjust :attr: `~Context. prec
21852185RAM and expect 10 simultaneous operands using a maximum of 500MB each::
21862186
21872187   >>> import sys 
0 commit comments