[Python-checkins] python/dist/src/Doc/lib libdecimal.tex,1.5,1.6

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Mon Jul 5 23:13:31 CEST 2004

```Update of /cvsroot/python/python/dist/src/Doc/lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5645

Modified Files:
libdecimal.tex
Log Message:
Expand examples to show polymorphism

Index: libdecimal.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdecimal.tex,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** libdecimal.tex	5 Jul 2004 20:27:53 -0000	1.5
--- libdecimal.tex	5 Jul 2004 21:13:28 -0000	1.6
***************
*** 936,940 ****
"""
getcontext().prec += 9  # extra digits for intermediate steps
!     three = Decimal(3)        # substitute "three=3.0" for regular floats
lastc, t, c, n, na, d, da = 0, three, 3, 1, 0, 0, 24
while c != lastc:
--- 936,940 ----
"""
getcontext().prec += 9  # extra digits for intermediate steps
!     three = Decimal(3)      # substitute "three=3.0" for regular floats
lastc, t, c, n, na, d, da = 0, three, 3, 1, 0, 0, 24
while c != lastc:
***************
*** 948,952 ****

def exp(x):
!     """Return e raised to the power of x.

>>> print exp(Decimal(1))
--- 948,952 ----

def exp(x):
!     """Return e raised to the power of x.  Result type matches input type.

>>> print exp(Decimal(1))
***************
*** 954,957 ****
--- 954,961 ----
>>> print exp(Decimal(2))
7.389056098930650227230427460575007813
+     >>> print exp(2.0)
+     7.38905609893
+     >>> print exp(2+0j)
+     (7.38905609893+0j)
"""
getcontext().prec += 9  # extra digits for intermediate steps
***************
*** 971,974 ****
--- 975,982 ----
>>> print cos(Decimal('0.5'))
0.8775825618903727161162815826038296521
+     >>> print cos(0.5)
+     0.87758256189
+     >>> print cos(0.5+0j)
+     (0.87758256189+0j)
"""
getcontext().prec += 9  # extra digits for intermediate steps
***************
*** 989,992 ****
--- 997,1004 ----
>>> print sin(Decimal('0.5'))
0.4794255386042030002732879352155713880
+     >>> print sin(0.5)
+     0.479425538604
+     >>> print sin(0.5+0j)
+     (0.479425538604+0j)
"""
getcontext().prec += 9  # extra digits for intermediate steps

```

More information about the Python-checkins mailing list