@@ -51,6 +51,7 @@ Currently the :external+py3.14:mod:`math` module code in the CPython is around
5151comparable with the :external+py3.14:mod: `cmath ` (1340LOC), which is *not * a
5252simple wrapper to the ``libm ``, as most functions in the
5353:external+py3.14:mod: `math ` module.
54+
5455And this situation tends to get worse. When the module split `was first
5556proposed
5657<https://mail.python.org/archives/list/python-ideas@python.org/thread/YYJ5YJBJNCVXQWK5K3WSVNMPUSV56LOR/> `_,
@@ -59,6 +60,23 @@ there were only two integer-related functions:
5960Now there are six and :external+py3.14:func: `~math.factorial ` doesn't accept
6061:class: `float `'s anymore.
6162
63+ Some possible additions, among those proposed in the initial discussion thread
64+ and issue
65+ `python/cpython#81313 <https://github.com/python/cpython/issues/81313 >`_ are:
66+
67+ * ``ceil_div() `` --- for integer ceiling divide, see
68+ `relevant discussion thread <https://discuss.python.org/t/91269 >`_.
69+ * ``gcdext() `` --- to solve linear `Diophantine equation <https://en.wikipedia.org/wiki/Diophantine_equation >`_ in two variables (the
70+ :external+py3.14:class: `int ` implementation actually includes an extended
71+ Euclidean algorithm)
72+ * ``isqrt_rem() `` --- to return both an integer square root and a remainder (which is non-zero only if
73+ the integer isn't a perfect square)
74+ * ``ilog() `` --- integer logarithm, :external+py3.14:func: `math.log `
75+ has special handling for integer arguments. It's unique (with respect to other module
76+ functions) and not documented so far, see issue
77+ `python/cpython#120950 <https://github.com/python/cpython/issues/120950 >`_.
78+ * ``fibonacci() `` --- `Fibonacci sequence <https://en.wikipedia.org/wiki/Fibonacci_sequence >`_.
79+
6280
6381Rationale
6482=========
@@ -98,9 +116,21 @@ Module functions will accept integers and objects that implement the
98116object to an integer number. Suitable functions must be computed exactly,
99117given sufficient time and memory.
100118
101- Possible extensions for the new module and its scope are discussed in the
102- `Open Issues <Open Issues _>`_ section. New functions are not part of this
103- proposal.
119+
120+ Possible Extensions
121+ ===================
122+
123+ New functions (like mentioned in `Motivation <Motivation _>`_ section) are not
124+ part of this proposal.
125+
126+ Though, we should mention that, Unless we can just provide bindings to some
127+ well supported mathematical library like the GMP, the module scope should be
128+ limited. For example, no primality testing and factorization, as
129+ production-quality implementatons will require a decent mathematical background
130+ from contributors and belongs rather to specialized libraries.
131+
132+ When proposed function already exists in the :pypi: `gmpy2 `, we should prefer a
133+ compatible interface for the stdlib.
104134
105135
106136Backwards Compatibility
@@ -131,39 +161,6 @@ Reference Implementation
131161`python/cpython#133909 <https://github.com/python/cpython/pull/133909 >`_
132162
133163
134- Open Issues
135- ===========
136-
137- Module scope and possible extensions
138- ------------------------------------
139-
140- Unless we can just provide bindings to some well supported mathematical library
141- like the GMP, the module scope should be limited. For example, no primality
142- testing and factorization, as production-quality implementatons will require a
143- decent mathematical background from contributors and belongs rather to
144- specialized libraries.
145-
146- Some possible additions, among those proposed in the initial discussion thread
147- (see also issue
148- `python/cpython#81313 <https://github.com/python/cpython/issues/81313 >`_):
149-
150- * ``ceil_div() `` --- for integer ceiling divide, see
151- `relevant discussion thread <https://discuss.python.org/t/91269 >`_.
152- * ``gcdext() `` --- to solve linear `Diophantine equation <https://en.wikipedia.org/wiki/Diophantine_equation >`_ in two variables (the
153- :external+py3.14:class: `int ` implementation actually includes an extended
154- Euclidean algorithm)
155- * ``isqrt_rem() `` --- to return both an integer square root and a remainder (which is non-zero only if
156- the integer isn't a perfect square)
157- * ``ilog() `` --- integer logarithm, :external+py3.14:func: `math.log `
158- has special handling for integer arguments. It's unique (with respect to other module
159- functions) and not documented so far, see issue
160- `python/cpython#120950 <https://github.com/python/cpython/issues/120950 >`_.
161- * ``fibonacci() `` --- `Fibonacci sequence <https://en.wikipedia.org/wiki/Fibonacci_sequence >`_.
162-
163- When proposed function already exists in the :pypi: `gmpy2 `, we should prefer a
164- compatible interface for the stdlib.
165-
166-
167164Rejected ideas
168165==============
169166
0 commit comments