[Python-checkins] python/dist/src/Doc/lib libdecimal.tex, 1.27, 1.28
rhettinger@users.sourceforge.net
rhettinger at users.sourceforge.net
Fri Jul 1 18:54:15 CEST 2005
Update of /cvsroot/python/python/dist/src/Doc/lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19113
Modified Files:
libdecimal.tex
Log Message:
More info on rounding modes. Add sections for floating point notes.
Index: libdecimal.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdecimal.tex,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- libdecimal.tex 15 Jun 2005 16:53:31 -0000 1.27
+++ libdecimal.tex 1 Jul 2005 16:54:12 -0000 1.28
@@ -501,13 +501,15 @@
arithmetic operations in the context.
The \var{rounding} option is one of:
- \constant{ROUND_CEILING} (towards \constant{Infinity}),
- \constant{ROUND_DOWN} (towards zero),
- \constant{ROUND_FLOOR} (towards \constant{-Infinity}),
- \constant{ROUND_HALF_DOWN} (towards zero),
- \constant{ROUND_HALF_EVEN},
- \constant{ROUND_HALF_UP} (away from zero), or
- \constant{ROUND_UP} (away from zero).
+ \begin{itemize}
+ \item \constant{ROUND_CEILING} (towards \constant{Infinity}),
+ \item \constant{ROUND_DOWN} (towards zero),
+ \item \constant{ROUND_FLOOR} (towards \constant{-Infinity}),
+ \item \constant{ROUND_HALF_DOWN} (to nearest with ties going towards zero),
+ \item \constant{ROUND_HALF_EVEN} (to nearest with ties going to nearest even integer),
+ \item \constant{ROUND_HALF_UP} (to nearest with ties going away from zero), or
+ \item \constant{ROUND_UP} (away from zero).
+ \end{itemize}
The \var{traps} and \var{flags} fields list any signals to be set.
Generally, new contexts should only set traps and leave the flags clear.
@@ -834,6 +836,8 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Floating Point Notes \label{decimal-notes}}
+\subsubsection{Mitigating round-off error with increased precision}
+
The use of decimal floating point eliminates decimal representation error
(making it possible to represent \constant{0.1} exactly); however, some
operations can still incur round-off error when non-zero digits exceed the
@@ -881,6 +885,7 @@
Decimal("0.0060000")
\end{verbatim}
+\subsubsection{Special values}
The number system for the \module{decimal} module provides special
values including \constant{NaN}, \constant{sNaN}, \constant{-Infinity},
More information about the Python-checkins
mailing list