Skip to content

Commit bf0d67f

Browse files
committed
address review: move inline footnotes 5-7
1 parent b573c82 commit bf0d67f

File tree

1 file changed

+21
-25
lines changed

1 file changed

+21
-25
lines changed

peps/pep-0812.rst

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,19 @@ be implemented with this approach simply by:
143143
144144
145145
It's pioneered by the C99 standard ([3]_, [4]_). This is also how complex
146-
arithmetic is implemented in the Ada language [5]_. Some mathematical libraries
147-
(like the GNU GSL [6]_) or the GNU MPC [7]_) have special routines to implement
148-
mixed-mode arithmetic for complex numbers, i.e., when one operand either
149-
pure-real or pure-imaginary. As a side effect, this also introduces some
150-
performance boost for operations with mixed types (e.g., multiplication of
151-
complex and real numbers costs only two real multiplications, not four).
152-
Although it's more important that in the IEC floating-point arithmetic results
153-
here are uniquely determined by the usual mathematical formulae.
146+
arithmetic is implemented in the Ada language, see the `Ada 2022 Reference
147+
Manual, Annex G <http://ada-auth.org/standards/22rm/RM-Final.pdf>`_. Some
148+
mathematical libraries (like the GNU GSL, see the `GSL Reference Manual, §5.5
149+
<https://www.gnu.org/software/gsl/doc/latex/gsl-ref.pdf>`_) or the GNU MPC, see
150+
the `MPC Reference Manual, §5.7
151+
<https://www.multiprecision.org/downloads/mpc-1.3.1.pdf>`_) have special
152+
routines to implement mixed-mode arithmetic for complex numbers, i.e., when one
153+
operand either pure-real or pure-imaginary. As a side effect, this also
154+
introduces some performance boost for operations with mixed types (e.g.,
155+
multiplication of complex and real numbers costs only two real multiplications,
156+
not four). Although it's more important that in the IEC floating-point
157+
arithmetic results here are uniquely determined by the usual mathematical
158+
formulae.
154159

155160
For a first step, :cpython-pr:`124829` added in the CPython 3.14 mixed-mode
156161
rules for complex arithmetic, combining real and complex operands. So, some
@@ -205,7 +210,7 @@ of the complex arithmetic.
205210
Upcoming C2y standard abandons the imaginary type
206211
-------------------------------------------------
207212

208-
That [8]_ might be viewed as a failure of the new approach: no compiler from major
213+
That [5]_ might be viewed as a failure of the new approach: no compiler from major
209214
players had a correct implementation of the C99 Annex G.
210215

211216
On the other hand, this might be also viewed as an indication of poor adoption of
@@ -215,7 +220,7 @@ arithmetic from the C language, and things will hardly be changed soon.
215220

216221
It's also important to note that removal documents from the C language
217222
committee don't discuss mathematical arguments for the imaginary types at all
218-
[9]_.
223+
[6]_.
219224

220225

221226
Specification
@@ -316,12 +321,12 @@ result has real type. If either operand has complex type, then the result has
316321
complex type.
317322

318323
This specification does not indicate how exactly the results are to be evaluated
319-
[10]_ for complex multiplication (when *both* operands are complex numbers) and
324+
[7]_ for complex multiplication (when *both* operands are complex numbers) and
320325
for division when the right operand is a complex number. Though, if
321326
the implementation of floating-point arithmetic supports the IEC 60559
322327
floating-point standard, results of all mixed-mode operations, except for
323328
division, are specified above unambiguously and it's also expected that
324-
multiplication always must be commutative [11]_, and that division compute result
329+
multiplication always must be commutative [8]_, and that division compute result
325330
without undue overflow or underflow.
326331

327332
The ``*`` and ``/`` operators satisfy the following infinity properties for
@@ -609,23 +614,14 @@ Footnotes
609614
by Jim Thomas and Jerome T. Coonen, The Journal of C Language Translation,
610615
Volume 5, Number 3, March 1994.
611616
612-
.. [5] `Ada 2022 Reference Manual
613-
<http://ada-auth.org/standards/22rm/RM-Final.pdf>`_, Annex G.
614-
615-
.. [6] `GNU Scientific Library, Release 2.7
616-
<https://www.gnu.org/software/gsl/doc/latex/gsl-ref.pdf>`_, §5.5.
617-
618-
.. [7] `The GNU Multiple Precision Complex Library, Edition 1.3.1
619-
<https://www.multiprecision.org/downloads/mpc-1.3.1.pdf>`_, §5.7.
620-
621-
.. [8] `N3274: Remove imaginary types
617+
.. [5] `N3274: Remove imaginary types
622618
<https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3274.pdf>`_.
623619
https://open-std.org/, WG14. June 14, 2024.
624620
625-
.. [9] See `N3206: The future of imaginary types
621+
.. [6] See `N3206: The future of imaginary types
626622
<https://open-std.org/JTC1/SC22/WG14/www/docs/n3206.htm>`_, WG14. 2023.
627623
628-
.. [10] Another alternative for the multiplication of complex numbers
624+
.. [7] Another alternative for the multiplication of complex numbers
629625
(with only three multiplies), see e.g. "Handbook of Floating-Point
630626
Arithmetic" by Muller at al, 2010, Algorithm 4.8:
631627
@@ -641,7 +637,7 @@ Footnotes
641637
642638
Other variants include using a fused multiply-add (FMA) instruction.
643639
644-
.. [11] Its easy to smash this property, as shows the `following algorithm
640+
.. [8] Its easy to smash this property, as shows the `following algorithm
645641
<https://www.mjr19.org.uk/IT/IEEE_complex.html>`_:
646642
647643
.. code:: python

0 commit comments

Comments
 (0)