mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Explain that most floats are actually integers. This is a common confusion
for people using floor(), ceil() and modf().
This commit is contained in:
parent
9a729a1cc5
commit
abba5c067d
1 changed files with 8 additions and 0 deletions
|
@ -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
|
second return value through an `output parameter' (there is no such
|
||||||
thing in Python).
|
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:
|
Power and logarithmic functions:
|
||||||
|
|
||||||
\begin{funcdesc}{exp}{x}
|
\begin{funcdesc}{exp}{x}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue