This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients mark.dickinson, vstinner
Date 2015-03-05.22:57:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
To implement the PEP 485 (math.isclose), I proposed to split the math module into two parts: _math (C) and math (py). The current C module is renamed to _math and a new "math" module implementd in Python is added. The math module contains "from _math import *".

Attached patch implements this idea. contains the Python implementation of the following functions:

- degrees
- fsum
- factorial
- radians

I propose to add these functions to "document" the implementation of these functions, I don't want to use the Python implementation by default.

Maybe _math.degrees() and _math.radians() can be removed, the Python implementation is enough.

I'm not sure that the C implementation of factorial() is much faster, since most part of the C code calls Python functions (boxing/unboxing). But it's probably better to keep the C implementation :-)

I don't understand how _factorial_partial_product() decide to divide the computation using the number of bits. Does it make sense to compute the number of bits in Python, since the Python int type has no limit? (only memory)

The C and Python implementations are tested by test_math. cannot be used alone: it requires floor(), isfinite(), isinf() and isnan() functions of the _math module. The "try: import _math except ImportError: pass" is only useful for unit tests.

TODO: remove SIZEOF_LONG from

We may rename Module/mathmodule.c to Module/_mathmodule.c, but it's not convinient to generate a patch if a file is renamed.
Date User Action Args
2015-03-05 22:57:32vstinnersetrecipients: + vstinner, mark.dickinson
2015-03-05 22:57:31vstinnersetmessageid: <>
2015-03-05 22:57:31vstinnerlinkissue23595 messages
2015-03-05 22:57:31vstinnercreate