diff options
Diffstat (limited to 'Doc/tutorial/stdlib2.rst')
-rw-r--r-- | Doc/tutorial/stdlib2.rst | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/Doc/tutorial/stdlib2.rst b/Doc/tutorial/stdlib2.rst index 0d1d4c7..0197a6f 100644 --- a/Doc/tutorial/stdlib2.rst +++ b/Doc/tutorial/stdlib2.rst @@ -61,8 +61,8 @@ formatting numbers with group separators:: >>> x = 1234567.8 >>> locale.format("%d", x, grouping=True) '1,234,567' - >>> locale.format("%s%.*f", (conv['currency_symbol'], - ... conv['frac_digits'], x), grouping=True) + >>> locale.format_string("%s%.*f", (conv['currency_symbol'], + ... conv['frac_digits'], x), grouping=True) '$1,234,567.80' @@ -347,12 +347,15 @@ Decimal Floating Point Arithmetic The :mod:`decimal` module offers a :class:`Decimal` datatype for decimal floating point arithmetic. Compared to the built-in :class:`float` -implementation of binary floating point, the new class is especially helpful for -financial applications and other uses which require exact decimal -representation, control over precision, control over rounding to meet legal or -regulatory requirements, tracking of significant decimal places, or for -applications where the user expects the results to match calculations done by -hand. +implementation of binary floating point, the class is especially helpful for + +* financial applications and other uses which require exact decimal + representation, +* control over precision, +* control over rounding to meet legal or regulatory requirements, +* tracking of significant decimal places, or +* applications where the user expects the results to match calculations done by + hand. For example, calculating a 5% tax on a 70 cent phone charge gives different results in decimal floating point and binary floating point. The difference |