diff options
author | Raymond Hettinger <python@rcn.com> | 2005-09-11 18:21:52 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2005-09-11 18:21:52 (GMT) |
commit | 1166638be557c872f27457e2ab32033d3e6b4541 (patch) | |
tree | 231a1339dbcac54c33260be121f0804bc207cc3a /Doc/lib | |
parent | a1d09e2dedc6c721280fea74aee4e903859655de (diff) | |
download | cpython-1166638be557c872f27457e2ab32033d3e6b4541.zip cpython-1166638be557c872f27457e2ab32033d3e6b4541.tar.gz cpython-1166638be557c872f27457e2ab32033d3e6b4541.tar.bz2 |
Add FAQ entry regarding non-expoential representation.
Diffstat (limited to 'Doc/lib')
-rw-r--r-- | Doc/lib/libdecimal.tex | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Doc/lib/libdecimal.tex b/Doc/lib/libdecimal.tex index c11ad85..c7e66d9 100644 --- a/Doc/lib/libdecimal.tex +++ b/Doc/lib/libdecimal.tex @@ -32,7 +32,7 @@ differences prevent reliable equality testing and differences can accumulate. For this reason, decimal would be preferred in accounting applications which have strict equality invariants. -\item The decimal module incorporates notion of significant places so that +\item The decimal module incorporates a notion of significant places so that \samp{1.30 + 1.20} is \constant{2.50}. The trailing zero is kept to indicate significance. This is the customary presentation for monetary applications. For multiplication, the ``schoolbook'' approach uses all the figures in the @@ -1141,7 +1141,7 @@ Decimal("4.68") \end{verbatim} -Q. In a fixed-point application to two decimal places, some inputs +Q. In a fixed-point application with two decimal places, some inputs have many places and need to be rounded. Others are not supposed to have excess digits and need to be validated. What methods should be used? @@ -1189,6 +1189,15 @@ representive: \end{verbatim} +Q. Some decimal values always print with exponential notation. Is there +a way to get a non-exponential representation? + +A. For some values, exponential notation is the only way to express +the number of significant places in the coefficient. For example, +expressing \constant{5.0E+3} as \constant{5000} keeps the value +constant but cannot show the original's two-place significance. + + Q. Is there a way to convert a regular float to a \class{Decimal}? A. Yes, all binary floating point numbers can be exactly expressed as a |