Skip to content

Commit 66c6727

Browse files
author
rhettinger
committed
More info on rounding modes. Add sections for floating point notes.
git-svn-id: http://svn.python.org/projects/python/trunk@39107 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 8d97131 commit 66c6727

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

Doc/lib/libdecimal.tex

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -501,13 +501,15 @@ \subsection{Context objects \label{decimal-decimal}}
501501
arithmetic operations in the context.
502502

503503
The \var{rounding} option is one of:
504-
\constant{ROUND_CEILING} (towards \constant{Infinity}),
505-
\constant{ROUND_DOWN} (towards zero),
506-
\constant{ROUND_FLOOR} (towards \constant{-Infinity}),
507-
\constant{ROUND_HALF_DOWN} (towards zero),
508-
\constant{ROUND_HALF_EVEN},
509-
\constant{ROUND_HALF_UP} (away from zero), or
510-
\constant{ROUND_UP} (away from zero).
504+
\begin{itemize}
505+
\item \constant{ROUND_CEILING} (towards \constant{Infinity}),
506+
\item \constant{ROUND_DOWN} (towards zero),
507+
\item \constant{ROUND_FLOOR} (towards \constant{-Infinity}),
508+
\item \constant{ROUND_HALF_DOWN} (to nearest with ties going towards zero),
509+
\item \constant{ROUND_HALF_EVEN} (to nearest with ties going to nearest even integer),
510+
\item \constant{ROUND_HALF_UP} (to nearest with ties going away from zero), or
511+
\item \constant{ROUND_UP} (away from zero).
512+
\end{itemize}
511513

512514
The \var{traps} and \var{flags} fields list any signals to be set.
513515
Generally, new contexts should only set traps and leave the flags clear.
@@ -834,6 +836,8 @@ \subsection{Signals \label{decimal-signals}}
834836
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
835837
\subsection{Floating Point Notes \label{decimal-notes}}
836838

839+
\subsubsection{Mitigating round-off error with increased precision}
840+
837841
The use of decimal floating point eliminates decimal representation error
838842
(making it possible to represent \constant{0.1} exactly); however, some
839843
operations can still incur round-off error when non-zero digits exceed the
@@ -881,6 +885,7 @@ \subsection{Floating Point Notes \label{decimal-notes}}
881885
Decimal("0.0060000")
882886
\end{verbatim}
883887

888+
\subsubsection{Special values}
884889

885890
The number system for the \module{decimal} module provides special
886891
values including \constant{NaN}, \constant{sNaN}, \constant{-Infinity},

0 commit comments

Comments
 (0)