diff options
author | Fred Drake <fdrake@acm.org> | 1999-05-06 14:46:35 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 1999-05-06 14:46:35 (GMT) |
commit | 1ea7c7568769e156164ed4c860e3778f844fe502 (patch) | |
tree | 375f88fc0939b840cea76c51b80ed0af12e2b701 /Doc/lib/libfuncs.tex | |
parent | 9263e78ff22a5aaa0c2b460df966e048dd28f90d (diff) | |
download | cpython-1ea7c7568769e156164ed4c860e3778f844fe502.zip cpython-1ea7c7568769e156164ed4c860e3778f844fe502.tar.gz cpython-1ea7c7568769e156164ed4c860e3778f844fe502.tar.bz2 |
Reflect recent patch for float % and divmod() by Tim Peters. Content
updates by Tim Peters, markup by FLD.
Diffstat (limited to 'Doc/lib/libfuncs.tex')
-rw-r--r-- | Doc/lib/libfuncs.tex | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Doc/lib/libfuncs.tex b/Doc/lib/libfuncs.tex index df384af..d2167fb 100644 --- a/Doc/lib/libfuncs.tex +++ b/Doc/lib/libfuncs.tex @@ -178,8 +178,12 @@ class instances are callable if they have a \method{__call__()} method. operand types, the rules for binary arithmetic operators apply. For plain and long integers, the result is the same as \code{(\var{a} / \var{b}, \var{a} \%{} \var{b})}. - For floating point numbers the result is the same as - \code{(math.floor(\var{a} / \var{b}), \var{a} \%{} \var{b})}. + For floating point numbers the result is \code{(\var{q}, \var{a} \%{} + \var{b})}, where \var{q} is usually \code{math.floor(\var{a} / + \var{b})} but may be 1 less than that. In any case \code{\var{q} * + \var{b} + \var{a} \%{} \var{b}} is very close to \var{a}, if + \code{\var{a} \%{} \var{b}} is non-zero it has the same sign as + \var{b}, and \code{0 <= abs(\var{a} \%{} \var{b}) < abs(\var{b})}. \end{funcdesc} \begin{funcdesc}{eval}{expression\optional{, globals\optional{, locals}}} |