@@ -270,9 +270,8 @@ numbers of mixed type use the same rule. [#]_ The constructors :func:`int`,
270270:func: `long `, :func: `float `, and :func: `complex ` can be used to produce numbers
271271of a specific type.
272272
273- All numeric types (except complex) support the following operations, sorted by
274- ascending priority (operations in the same box have the same priority; all
275- numeric operations have a higher priority than comparison operations):
273+ All builtin numeric types support the following operations. See
274+ :ref: `power ` and later sections for the operators' priorities.
276275
277276+--------------------+---------------------------------+--------+
278277| Operation | Result | Notes |
@@ -285,7 +284,7 @@ numeric operations have a higher priority than comparison operations):
285284+--------------------+---------------------------------+--------+
286285| ``x / y `` | quotient of *x * and *y * | \( 1) |
287286+--------------------+---------------------------------+--------+
288- | ``x // y `` | (floored) quotient of *x * and | \( 5) |
287+ | ``x // y `` | (floored) quotient of *x * and | (4)(5) |
289288| | *y * | |
290289+--------------------+---------------------------------+--------+
291290| ``x % y `` | remainder of ``x / y `` | \( 4) |
@@ -294,7 +293,7 @@ numeric operations have a higher priority than comparison operations):
294293+--------------------+---------------------------------+--------+
295294| ``+x `` | *x * unchanged | |
296295+--------------------+---------------------------------+--------+
297- | ``abs(x) `` | absolute value or magnitude of | |
296+ | ``abs(x) `` | absolute value or magnitude of | \( 3) |
298297| | *x * | |
299298+--------------------+---------------------------------+--------+
300299| ``int(x) `` | *x * converted to integer | \( 2) |
@@ -308,11 +307,11 @@ numeric operations have a higher priority than comparison operations):
308307| | *im * defaults to zero. | |
309308+--------------------+---------------------------------+--------+
310309| ``c.conjugate() `` | conjugate of the complex number | |
311- | | *c * | |
310+ | | *c *. (Identity on real numbers) | |
312311+--------------------+---------------------------------+--------+
313312| ``divmod(x, y) `` | the pair ``(x // y, x % y) `` | (3)(4) |
314313+--------------------+---------------------------------+--------+
315- | ``pow(x, y) `` | *x * to the power *y * | |
314+ | ``pow(x, y) `` | *x * to the power *y * | \( 3) |
316315+--------------------+---------------------------------+--------+
317316| ``x ** y `` | *x * to the power *y * | |
318317+--------------------+---------------------------------+--------+
@@ -341,9 +340,12 @@ Notes:
341340 pair: numeric; conversions
342341 pair: C; language
343342
344- Conversion from floating point to (long or plain) integer may round or truncate
345- as in C; see functions :func: `floor ` and :func: `ceil ` in the :mod: `math ` module
346- for well-defined conversions.
343+ Conversion from floating point to (long or plain) integer may round or
344+ truncate as in C.
345+
346+ .. deprecated :: 2.6
347+ Instead, convert floats to long explicitly with :func: `trunc `,
348+ :func: `math.floor `, or :func: `math.ceil `.
347349
348350(3)
349351 See :ref: `built-in-funcs ` for a full description.
@@ -364,6 +366,22 @@ Notes:
364366
365367 .. versionadded :: 2.6
366368
369+ All :class: `numbers.Real ` types (:class: `int `, :class: `long `, and
370+ :class: `float `) also include the following operations:
371+
372+ +--------------------+--------------------------------+--------+
373+ | Operation | Result | Notes |
374+ +====================+================================+========+
375+ | ``trunc(x) `` | *x * truncated to Integral | |
376+ +--------------------+--------------------------------+--------+
377+ | ``round(x[, n]) `` | *x * rounded to n digits, | |
378+ | | rounding half to even. If n is | |
379+ | | omitted, it defaults to 0. | |
380+ +--------------------+--------------------------------+--------+
381+ | ``math.floor(x) `` | the greatest Integral <= *x * | |
382+ +--------------------+--------------------------------+--------+
383+ | ``math.ceil(x) `` | the least Integral >= *x * | |
384+ +--------------------+--------------------------------+--------+
367385
368386.. XXXJH exceptions: overflow (when? what operations?) zerodivision
369387
0 commit comments