diff options
author | Raymond Hettinger <python@rcn.com> | 2008-02-14 11:01:10 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2008-02-14 11:01:10 (GMT) |
commit | 27a90d989db3b6e748ccf08556464a6b830c19f0 (patch) | |
tree | 235c14f2b51fde3d0c88a31f3bab14b7e1df7f8e /Doc/library | |
parent | 4631481dfdffab442f1295342c1c4e2663759060 (diff) | |
download | cpython-27a90d989db3b6e748ccf08556464a6b830c19f0.zip cpython-27a90d989db3b6e748ccf08556464a6b830c19f0.tar.gz cpython-27a90d989db3b6e748ccf08556464a6b830c19f0.tar.bz2 |
Improve rst markup
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/decimal.rst | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Doc/library/decimal.rst b/Doc/library/decimal.rst index 7af200c..2f191bd 100644 --- a/Doc/library/decimal.rst +++ b/Doc/library/decimal.rst @@ -1580,17 +1580,16 @@ be followed-up with a :meth:`quantize` step. Decimal('4314.24') >>> (a * b).quantize(TWOPLACES) # Must quantize non-integer multiplication Decimal('325.62') - >>> (b / a).quantize(TWOPLACES) # And quantize divisions + >>> (b / a).quantize(TWOPLACES) # And quantize division Decimal('0.03') In developing fixed-point applications, it is convenient to define functions to handle the :meth:`quantize` step:: - def mul(x, y, fp=TWOPLACES): - return (x * y).quantize(fp) - def div(x, y, fp=TWOPLACES): - return (x / y).quantize(fp) - + >>> def mul(x, y, fp=TWOPLACES): + ... return (x * y).quantize(fp) + >>> def div(x, y, fp=TWOPLACES): + ... return (x / y).quantize(fp) >>> mul(a, b) # Automatically preserve fixed-point Decimal('325.62') >>> div(b, a) |