[Python-checkins] python/dist/src/Doc/ref ref5.tex,1.68,1.69
tim_one@users.sourceforge.net
tim_one@users.sourceforge.net
Sun, 24 Nov 2002 12:23:06 -0800
Update of /cvsroot/python/python/dist/src/Doc/ref
In directory sc8-pr-cvs1:/tmp/cvs-serv1233/python/Doc/ref
Modified Files:
ref5.tex
Log Message:
Repaired inaccuracies in the % docs. In particular, we don't (and can't)
guarantee abs(x%y) < abs(y) in all cases when a float is involved.
math.fmod() should, though, so noted that too.
Bugfix candidate. Someone should check the LaTeX here first, though.
Index: ref5.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref5.tex,v
retrieving revision 1.68
retrieving revision 1.69
diff -C2 -d -r1.68 -r1.69
*** ref5.tex 13 Nov 2002 15:32:34 -0000 1.68
--- ref5.tex 24 Nov 2002 20:23:04 -0000 1.69
***************
*** 695,700 ****
\code{3.14} equals \code{4*0.7 + 0.34}.) The modulo operator always
yields a result with the same sign as its second operand (or zero);
! the absolute value of the result is strictly smaller than the second
! operand.
\index{modulo}
--- 695,711 ----
\code{3.14} equals \code{4*0.7 + 0.34}.) The modulo operator always
yields a result with the same sign as its second operand (or zero);
! the absolute value of the result is strictly smaller than the absolute
! value of the second operand\footnote{
! While \code{abs(x\%y) < abs(y)) is true mathematically, for
! floats it may not be true numerically due to roundoff. For
! example, and assuming a platform on which a Python float is an
! IEEE 754 double-precision number, in order that \code{-1e-100 \% 1e100}
! have the same sign as \code{1e100}, the computed result is
! \code{-1e-100 + 1e100}, which is numerically exactly equal
! to \code{1e100}. Function \function{fmod()} in the \module{math}
! module returns a result whose sign matches the sign of the
! first argument instead, and so returns \code{-1e-100} in this case.
! Which approach is more appropriate depends on the application.
! }.
\index{modulo}
***************
*** 705,709 ****
floating point numbers; there similar identities hold
approximately where \code{x/y} is replaced by \code{floor(x/y)}) or
! \code{floor(x/y) - 1} (for floats),\footnote{
If x is very close to an exact integer multiple of y, it's
possible for \code{floor(x/y)} to be one larger than
--- 716,720 ----
floating point numbers; there similar identities hold
approximately where \code{x/y} is replaced by \code{floor(x/y)}) or
! \code{floor(x/y) - 1}\footnote{
If x is very close to an exact integer multiple of y, it's
possible for \code{floor(x/y)} to be one larger than