diff options
author | Tim Peters <tim.peters@gmail.com> | 2004-07-26 05:12:01 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2004-07-26 05:12:01 (GMT) |
commit | abba5c067d42e3ecf3ad018f8ae98f60ef1ca170 (patch) | |
tree | 8a77d7b16f9618647073e3cf28824e610e5e675e /Doc/lib | |
parent | 9a729a1cc522cd40a83c0fb1c23c2bfb545be261 (diff) | |
download | cpython-abba5c067d42e3ecf3ad018f8ae98f60ef1ca170.zip cpython-abba5c067d42e3ecf3ad018f8ae98f60ef1ca170.tar.gz cpython-abba5c067d42e3ecf3ad018f8ae98f60ef1ca170.tar.bz2 |
Explain that most floats are actually integers. This is a common confusion
for people using floor(), ceil() and modf().
Diffstat (limited to 'Doc/lib')
-rw-r--r-- | Doc/lib/libmath.tex | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Doc/lib/libmath.tex b/Doc/lib/libmath.tex index 7f25eba..e52f8f9 100644 --- a/Doc/lib/libmath.tex +++ b/Doc/lib/libmath.tex @@ -79,6 +79,14 @@ argument and return a pair of values, rather than returning their second return value through an `output parameter' (there is no such thing in Python). +For the \function{ceil()}, \function{floor()}, and \function{modf()} +functions, note that \emph{all} floating-point numbers of sufficiently +large magnitude are exact integers. Python floats typically carry no more +than 53 bits of precision (the same as the platform C double type), in +which case any float \var{x} with \code{abs(\var{x}) >= 2**52} +necessarily has no fractional bits. + + Power and logarithmic functions: \begin{funcdesc}{exp}{x} |