]> granicus.if.org Git - python/commitdiff
Explain that most floats are actually integers. This is a common confusion
authorTim Peters <tim.peters@gmail.com>
Mon, 26 Jul 2004 05:12:01 +0000 (05:12 +0000)
committerTim Peters <tim.peters@gmail.com>
Mon, 26 Jul 2004 05:12:01 +0000 (05:12 +0000)
for people using floor(), ceil() and modf().

Doc/lib/libmath.tex

index 7f25eba67586ee0b76cc5d0fbdb7e4a7fb3c03e8..e52f8f96fc05140ace995b27220a677a9792fcd8 100644 (file)
@@ -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}