[Python-checkins]
python/nondist/sandbox/decimal libdecimal.tex, 1.1, 1.2
rhettinger at users.sourceforge.net
rhettinger at users.sourceforge.net
Sun Jul 4 02:52:05 EDT 2004
Update of /cvsroot/python/python/nondist/sandbox/decimal
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30142
Modified Files:
libdecimal.tex
Log Message:
Fix nits.
Index: libdecimal.tex
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/decimal/libdecimal.tex,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** libdecimal.tex 4 Jul 2004 06:27:04 -0000 1.1
--- libdecimal.tex 4 Jul 2004 06:52:03 -0000 1.2
***************
*** 10,14 ****
\moduleauthor{Raymond Hettinger}{python at rcn.com}
\moduleauthor{Aahz}{aahz at pobox.com}
! \moduleauthor{Tim Peters}{guido at python.org}
\sectionauthor{Raymond D. Hettinger}{python at rcn.com}
--- 10,14 ----
\moduleauthor{Raymond Hettinger}{python at rcn.com}
\moduleauthor{Aahz}{aahz at pobox.com}
! \moduleauthor{Tim Peters}{tim.one at comcast.net}
\sectionauthor{Raymond D. Hettinger}{python at rcn.com}
***************
*** 24,35 ****
The decimal \module{module} provides support for decimal floating point
! arithmetic. It offers several advantages over the \class{float()} data type.
! Decimal numbers can be represented exactly. In contrast, numbers like
! \constant{1.1} do not have an exact reprentations in binary floating point.
End users typically wound not expect \constant{1.1} to display as
\constant{1.1000000000000001} as it does with binary floating point.
! The exactness carries over to arithmetic. In decimal floating point,
\code{0.1 + 0.1 + 0.1 - 0.3} is exactly equal to zero. In binary floating
point, result is \constant{5.5511151231257827e-017}. While near to zero, the
--- 24,37 ----
The decimal \module{module} provides support for decimal floating point
! arithmetic. It offers several advantages over the \class{float()} data type:
! \begin{itemize}
!
! \item Decimal numbers can be represented exactly. In contrast, numbers like
! \constant{1.1} do not have an exact representations in binary floating point.
End users typically wound not expect \constant{1.1} to display as
\constant{1.1000000000000001} as it does with binary floating point.
! \item The exactness carries over to arithmetic. In decimal floating point,
\code{0.1 + 0.1 + 0.1 - 0.3} is exactly equal to zero. In binary floating
point, result is \constant{5.5511151231257827e-017}. While near to zero, the
***************
*** 38,50 ****
have strict equality invariants.
! The decimal module incorporates notion signficant places so that
\code{1.30 + 1.20} is \constant{2.50}. The trailing zero is kept to indicate
significance. This is a customary presentation for monetary applications. For
! multiplication, a ``schoolbook'' approach uses all the figures in the
multiplicands. For instance, \code{1.3 * 1.2} gives \constant{1.56} while
\code{1.30 * 1.20} gives \constant{1.5600}.
! * Unlike hardware based binary floating point, the decimal module has a user
! settable precision (defaulting to 28 places) which can as large as needed for
a given problem:
--- 40,52 ----
have strict equality invariants.
! \item The decimal module incorporates notion of significant places so that
\code{1.30 + 1.20} is \constant{2.50}. The trailing zero is kept to indicate
significance. This is a customary presentation for monetary applications. For
! multiplication, the ``schoolbook'' approach uses all the figures in the
multiplicands. For instance, \code{1.3 * 1.2} gives \constant{1.56} while
\code{1.30 * 1.20} gives \constant{1.5600}.
! \item Unlike hardware based binary floating point, the decimal module has a user
! settable precision (defaulting to 28 places) which can be as large as needed for
a given problem:
***************
*** 57,65 ****
\end{verbatim}
! * Both binary and decimal floating point are implemented in terms of published
! standards. The builtin float type exposes only a modest portion of its
! capabilities. In contrast, the decimal module exposes all required parts of
! the standard. When needed, the programmer has full control over rounding and
! handling signals from the underlying implementation.
The module design is centered around three concepts: the decimal number, the
--- 59,69 ----
\end{verbatim}
! \item Both binary and decimal floating point are implemented in terms of published
! standards. While the built-in float type exposes only a modest portion of its
! capabilities, the decimal module exposes all required parts of the standard.
! When needed, the programmer has full control over rounding and signal handling.
!
! \end{itemize}
!
The module design is centered around three concepts: the decimal number, the
***************
*** 68,78 ****
A decimal number is immutable. It has a sign, coefficient digits, and an
exponent. To preserve significance, the coefficient digits do not truncate
! trailings zeros. Decimals also include special values such as
\constant{Infinity} (the result of \code{1 / 0}), \constant{-Infinity},
(the result of \code{-1 / 0}), and \constant{NaN} (the result of
! \code{0 / 0}).
The context for arithmetic is an environment specifying precision, rounding
! rules, limits on exponents, flags the indicate the results of operations,
and trap enablers which determine whether signals are to be treated as
exceptions. Rounding options include \constant{ROUND_CEILING},
--- 72,83 ----
A decimal number is immutable. It has a sign, coefficient digits, and an
exponent. To preserve significance, the coefficient digits do not truncate
! trailing zeroes. Decimals also include special values such as
\constant{Infinity} (the result of \code{1 / 0}), \constant{-Infinity},
(the result of \code{-1 / 0}), and \constant{NaN} (the result of
! \code{0 / 0}). The standard also differentiates \constant{-0} from
! \constant{+0}.
The context for arithmetic is an environment specifying precision, rounding
! rules, limits on exponents, flags that indicate the results of operations,
and trap enablers which determine whether signals are to be treated as
exceptions. Rounding options include \constant{ROUND_CEILING},
***************
*** 87,95 ****
\constant{DivisionImpossible}, \constant{DivisionUndefined},
\constant{Inexact}, \constant{InvalidContext}, \constant{Rounded},
! \constant{Subnormal}, \constant{Overflow}, \constant{Underflow}.
! For each there is a flag and a trap enabler. When a signal is encountered,
! its flag incremented from zero and, then, if the trap enabler is set to
! one, then the signal will raise an exception.
--- 92,100 ----
\constant{DivisionImpossible}, \constant{DivisionUndefined},
\constant{Inexact}, \constant{InvalidContext}, \constant{Rounded},
! \constant{Subnormal}, \constant{Overflow}, and \constant{Underflow}.
! For each signal there is a flag and a trap enabler. When a signal is
! encountered, its flag incremented from zero and, then, if the trap enabler
! is set to one, an exception is raised.
More information about the Python-checkins
mailing list