Backport PEP 3141 from the py3k branch to the trunk. This includes r50877 (just
the complex_pow part), r56649, r56652, r56715, r57296, r57302, r57359, r57361,
r57372, r57738, r57739, r58017, r58039, r58040, and r59390, and new
documentation. The only significant difference is that round(x) returns a float
to preserve backward-compatibility. See http://bugs.python.org/issue1689.
diff --git a/Doc/library/math.rst b/Doc/library/math.rst
index 17c75d3..f92610f 100644
--- a/Doc/library/math.rst
+++ b/Doc/library/math.rst
@@ -26,8 +26,9 @@
 
 .. function:: ceil(x)
 
-   Return the ceiling of *x* as a float, the smallest integer value greater than or
-   equal to *x*.
+   Return the ceiling of *x* as a float, the smallest integer value greater than
+   or equal to *x*. If *x* is not a float, delegates to ``x.__ceil__()``, which
+   should return an :class:`Integral` value.
 
 
 .. function:: fabs(x)
@@ -37,8 +38,9 @@
 
 .. function:: floor(x)
 
-   Return the floor of *x* as a float, the largest integer value less than or equal
-   to *x*.
+   Return the floor of *x* as a float, the largest integer value less than or
+   equal to *x*. If *x* is not a float, delegates to ``x.__floor__()``, which
+   should return an :class:`Integral` value.
 
 
 .. function:: fmod(x, y)