diff options
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/functions.rst | 11 | ||||
-rw-r--r-- | Doc/library/math.rst | 10 | ||||
-rw-r--r-- | Doc/library/stdtypes.rst | 32 | ||||
-rw-r--r-- | Doc/reference/expressions.rst | 3 |
4 files changed, 25 insertions, 31 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 3236ccd..0133e5c 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -986,13 +986,10 @@ available. They are listed here in alphabetical order. .. function:: round(x[, n]) Return the floating point value *x* rounded to *n* digits after the decimal - point. If *n* is omitted, it defaults to zero. Values are rounded to the - closest multiple of 10 to the power minus *n*; if two multiples are equally - close, rounding is done toward the even choice (so, for example, both - ``round(0.5)`` and ``round(-0.5)`` are ``0``, and ``round(1.5)`` is - ``2``). Delegates to ``x.__round__(n)``. - - .. versionchanged:: 2.6 + point. If *n* is omitted, it defaults to zero. The result is a floating point + number. Values are rounded to the closest multiple of 10 to the power minus + *n*; if two multiples are equally close, rounding is done away from 0 (so. for + example, ``round(0.5)`` is ``1.0`` and ``round(-0.5)`` is ``-1.0``). .. function:: set([iterable]) diff --git a/Doc/library/math.rst b/Doc/library/math.rst index 8c9f0f8..6c78104 100644 --- a/Doc/library/math.rst +++ b/Doc/library/math.rst @@ -26,9 +26,8 @@ Number-theoretic and representation functions: .. function:: ceil(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. + Return the ceiling of *x* as a float, the smallest integer value greater than or + equal to *x*. .. function:: copysign(x, y) @@ -46,9 +45,8 @@ Number-theoretic and representation functions: .. function:: floor(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. + Return the floor of *x* as a float, the largest integer value less than or equal + to *x*. .. function:: fmod(x, y) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 7352a1d..7a0e24d 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -341,11 +341,11 @@ Notes: pair: C; language Conversion from floating point to (long or plain) integer may round or - truncate as in C. + truncate as in C; see functions :func:`math.floor` and :func:`math.ceil` for + well-defined conversions. .. deprecated:: 2.6 - Instead, convert floats to long explicitly with :func:`trunc`, - :func:`math.floor`, or :func:`math.ceil`. + Instead, convert floats to long explicitly with :func:`trunc`. (3) See :ref:`built-in-funcs` for a full description. @@ -369,19 +369,19 @@ Notes: All :class:`numbers.Real` types (:class:`int`, :class:`long`, and :class:`float`) also include the following operations: -+--------------------+--------------------------------+--------+ -| Operation | Result | Notes | -+====================+================================+========+ -| ``trunc(x)`` | *x* truncated to Integral | | -+--------------------+--------------------------------+--------+ -| ``round(x[, n])`` | *x* rounded to n digits, | | -| | rounding half to even. If n is | | -| | omitted, it defaults to 0. | | -+--------------------+--------------------------------+--------+ -| ``math.floor(x)`` | the greatest Integral <= *x* | | -+--------------------+--------------------------------+--------+ -| ``math.ceil(x)`` | the least Integral >= *x* | | -+--------------------+--------------------------------+--------+ ++--------------------+------------------------------------+--------+ +| Operation | Result | Notes | ++====================+====================================+========+ +| ``trunc(x)`` | *x* truncated to Integral | | ++--------------------+------------------------------------+--------+ +| ``round(x[, n])`` | *x* rounded to n digits, | | +| | rounding half to even. If n is | | +| | omitted, it defaults to 0. | | ++--------------------+------------------------------------+--------+ +| ``math.floor(x)`` | the greatest integral float <= *x* | | ++--------------------+------------------------------------+--------+ +| ``math.ceil(x)`` | the least integral float >= *x* | | ++--------------------+------------------------------------+--------+ .. XXXJH exceptions: overflow (when? what operations?) zerodivision diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst index 9c416f8..ea2bb1a 100644 --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -801,8 +801,7 @@ were of integer types and the second argument was negative, an exception was raised). Raising ``0.0`` to a negative power results in a :exc:`ZeroDivisionError`. -Raising a negative number to a fractional power results in a :class:`complex` -number. (Since Python 2.6. In earlier versions it raised a :exc:`ValueError`.) +Raising a negative number to a fractional power results in a :exc:`ValueError`. .. _unary: |