mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
[3.13] gh-121905: Consistently use "floating-point" instead of "floating point" (GH-121907) (GH-122012)
(cherry picked from commit 1a0c7b9ba4
)
This commit is contained in:
parent
225cbee8d8
commit
a45d9051ed
100 changed files with 238 additions and 238 deletions
|
@ -215,7 +215,7 @@ properties:
|
|||
|
||||
* A sign is shown only when the number is negative.
|
||||
|
||||
Python distinguishes between integers, floating point numbers, and complex
|
||||
Python distinguishes between integers, floating-point numbers, and complex
|
||||
numbers:
|
||||
|
||||
|
||||
|
@ -259,18 +259,18 @@ Booleans (:class:`bool`)
|
|||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. index::
|
||||
pair: object; floating point
|
||||
pair: floating point; number
|
||||
pair: object; floating-point
|
||||
pair: floating-point; number
|
||||
pair: C; language
|
||||
pair: Java; language
|
||||
|
||||
These represent machine-level double precision floating point numbers. You are
|
||||
These represent machine-level double precision floating-point numbers. You are
|
||||
at the mercy of the underlying machine architecture (and C or Java
|
||||
implementation) for the accepted range and handling of overflow. Python does not
|
||||
support single-precision floating point numbers; the savings in processor and
|
||||
support single-precision floating-point numbers; the savings in processor and
|
||||
memory usage that are usually the reason for using these are dwarfed by the
|
||||
overhead of using objects in Python, so there is no reason to complicate the
|
||||
language with two kinds of floating point numbers.
|
||||
language with two kinds of floating-point numbers.
|
||||
|
||||
|
||||
:class:`numbers.Complex` (:class:`complex`)
|
||||
|
@ -281,7 +281,7 @@ language with two kinds of floating point numbers.
|
|||
pair: complex; number
|
||||
|
||||
These represent complex numbers as a pair of machine-level double precision
|
||||
floating point numbers. The same caveats apply as for floating point numbers.
|
||||
floating-point numbers. The same caveats apply as for floating-point numbers.
|
||||
The real and imaginary parts of a complex number ``z`` can be retrieved through
|
||||
the read-only attributes ``z.real`` and ``z.imag``.
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ implementation for built-in types works as follows:
|
|||
|
||||
* If either argument is a complex number, the other is converted to complex;
|
||||
|
||||
* otherwise, if either argument is a floating point number, the other is
|
||||
* otherwise, if either argument is a floating-point number, the other is
|
||||
converted to floating point;
|
||||
|
||||
* otherwise, both must be integers and no conversion is necessary.
|
||||
|
@ -139,8 +139,8 @@ Python supports string and bytes literals and various numeric literals:
|
|||
: | `integer` | `floatnumber` | `imagnumber`
|
||||
|
||||
Evaluation of a literal yields an object of the given type (string, bytes,
|
||||
integer, floating point number, complex number) with the given value. The value
|
||||
may be approximated in the case of floating point and imaginary (complex)
|
||||
integer, floating-point number, complex number) with the given value. The value
|
||||
may be approximated in the case of floating-point and imaginary (complex)
|
||||
literals. See section :ref:`literals` for details.
|
||||
|
||||
.. index::
|
||||
|
@ -1361,7 +1361,7 @@ The floor division operation can be customized using the special
|
|||
The ``%`` (modulo) operator yields the remainder from the division of the first
|
||||
argument by the second. The numeric arguments are first converted to a common
|
||||
type. A zero right argument raises the :exc:`ZeroDivisionError` exception. The
|
||||
arguments may be floating point numbers, e.g., ``3.14%0.7`` equals ``0.34``
|
||||
arguments may be floating-point numbers, e.g., ``3.14%0.7`` equals ``0.34``
|
||||
(since ``3.14`` equals ``4*0.7 + 0.34``.) The modulo operator always yields a
|
||||
result with the same sign as its second operand (or zero); the absolute value of
|
||||
the result is strictly smaller than the absolute value of the second operand
|
||||
|
@ -1381,8 +1381,8 @@ The *modulo* operation can be customized using the special :meth:`~object.__mod_
|
|||
and :meth:`~object.__rmod__` methods.
|
||||
|
||||
The floor division operator, the modulo operator, and the :func:`divmod`
|
||||
function are not defined for complex numbers. Instead, convert to a floating
|
||||
point number using the :func:`abs` function if appropriate.
|
||||
function are not defined for complex numbers. Instead, convert to a
|
||||
floating-point number using the :func:`abs` function if appropriate.
|
||||
|
||||
.. index::
|
||||
single: addition
|
||||
|
|
|
@ -879,10 +879,10 @@ Numeric literals
|
|||
----------------
|
||||
|
||||
.. index:: number, numeric literal, integer literal
|
||||
floating point literal, hexadecimal literal
|
||||
floating-point literal, hexadecimal literal
|
||||
octal literal, binary literal, decimal literal, imaginary literal, complex literal
|
||||
|
||||
There are three types of numeric literals: integers, floating point numbers, and
|
||||
There are three types of numeric literals: integers, floating-point numbers, and
|
||||
imaginary numbers. There are no complex literals (complex numbers can be formed
|
||||
by adding a real number and an imaginary number).
|
||||
|
||||
|
@ -943,10 +943,10 @@ Some examples of integer literals::
|
|||
single: _ (underscore); in numeric literal
|
||||
.. _floating:
|
||||
|
||||
Floating point literals
|
||||
Floating-point literals
|
||||
-----------------------
|
||||
|
||||
Floating point literals are described by the following lexical definitions:
|
||||
Floating-point literals are described by the following lexical definitions:
|
||||
|
||||
.. productionlist:: python-grammar
|
||||
floatnumber: `pointfloat` | `exponentfloat`
|
||||
|
@ -958,10 +958,10 @@ Floating point literals are described by the following lexical definitions:
|
|||
|
||||
Note that the integer and exponent parts are always interpreted using radix 10.
|
||||
For example, ``077e010`` is legal, and denotes the same number as ``77e10``. The
|
||||
allowed range of floating point literals is implementation-dependent. As in
|
||||
allowed range of floating-point literals is implementation-dependent. As in
|
||||
integer literals, underscores are supported for digit grouping.
|
||||
|
||||
Some examples of floating point literals::
|
||||
Some examples of floating-point literals::
|
||||
|
||||
3.14 10. .001 1e100 3.14e-10 0e0 3.14_15_93
|
||||
|
||||
|
@ -982,9 +982,9 @@ Imaginary literals are described by the following lexical definitions:
|
|||
imagnumber: (`floatnumber` | `digitpart`) ("j" | "J")
|
||||
|
||||
An imaginary literal yields a complex number with a real part of 0.0. Complex
|
||||
numbers are represented as a pair of floating point numbers and have the same
|
||||
numbers are represented as a pair of floating-point numbers and have the same
|
||||
restrictions on their range. To create a complex number with a nonzero real
|
||||
part, add a floating point number to it, e.g., ``(3+4j)``. Some examples of
|
||||
part, add a floating-point number to it, e.g., ``(3+4j)``. Some examples of
|
||||
imaginary literals::
|
||||
|
||||
3.14j 10.j 10j .001j 1e100j 3.14e-10j 3.14_15_93j
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue