Commit Graph

182 Commits

Author SHA1 Message Date
Barry Warsaw b2e5794870 bpo-31338 (#3374)
* Add Py_UNREACHABLE() as an alias to abort().
* Use Py_UNREACHABLE() instead of assert(0)
* Convert more unreachable code to use Py_UNREACHABLE()
* Document Py_UNREACHABLE() and a few other macros.
2017-09-14 18:13:16 -07:00
Mark Dickinson a0ce375e10 bpo-29962: add math.remainder (#950)
* Implement math.remainder.

* Fix markup for arguments; use double spaces after period.

* Mark up function reference in what's new entry.

* Add comment explaining the calculation in the final branch.

* Fix out-of-order entry in whatsnew.

* Add comment explaining why it's good enough to compare m with c, in spite of possible rounding error.
2017-04-05 18:34:27 +01:00
Louie Lu 7a26464c64 bpo-29946: Fix "sqrtpi defined but not used" (#908) 2017-03-30 20:05:10 +03:00
Serhiy Storchaka 4125e5c60e bpo-26121: Revert to using the own implementations of lgamma and gamma on all platforms. (#637) 2017-03-12 14:08:06 +02:00
Serhiy Storchaka 97553fdf9d bpo-26121: Use C library implementation for math functions: (#515)
* bpo-26121: Use C library implementation for math functions:
tgamma(), lgamma(), erf() and erfc().

* Don't use tgamma() and lgamma() from libc on OS X.
2017-03-11 21:37:16 +00:00
Mark Dickinson 5e65cd39df Issue #29282: Backed out changeset b33012ef1417 2017-01-21 13:10:52 +00:00
Mark Dickinson d1b230e48b Issue #29282: add fused multiply-add function, math.fma. 2017-01-21 12:35:30 +00:00
Serhiy Storchaka c9ea933586 Issue #20186: Converted the math module to Argument Clinic.
Patch by Tal Einat.
2017-01-19 18:13:09 +02:00
Victor Stinner f17c3de263 Use _PyObject_CallNoArg()
Replace:
    PyObject_CallFunctionObjArgs(callable, NULL)
with:
    _PyObject_CallNoArg(callable)
2016-12-06 18:46:19 +01:00
Victor Stinner de4ae3d486 Backed out changeset b9c9691c72c5
Issue #28858: The change b9c9691c72c5 introduced a regression. It seems like
_PyObject_CallArg1() uses more stack memory than
PyObject_CallFunctionObjArgs().
2016-12-04 22:59:09 +01:00
Victor Stinner 27580c1fb5 Replace PyObject_CallFunctionObjArgs() with fastcall
* PyObject_CallFunctionObjArgs(func, NULL) => _PyObject_CallNoArg(func)
* PyObject_CallFunctionObjArgs(func, arg, NULL) => _PyObject_CallArg1(func, arg)

PyObject_CallFunctionObjArgs() allocates 40 bytes on the C stack and requires
extra work to "parse" C arguments to build a C array of PyObject*.

_PyObject_CallNoArg() and _PyObject_CallArg1() are simpler and don't allocate
memory on the C stack.

This change is part of the fastcall project. The change on listsort() is
related to the issue #23507.
2016-12-01 14:43:22 +01:00
Raymond Hettinger 15f44ab043 Issue #27895: Spelling fixes (Contributed by Ville Skyttä). 2016-08-30 10:47:49 -07:00
Guido van Rossum 0a891d70de Issue #12345: Add mathemathcal constant tau to math and cmath.
Patch by Lisa Roach. See also PEP 628.
2016-08-15 09:12:52 -07:00
Martin Panter 18933ed6ab Issue #26512: Merge rounding doc from 3.5 2016-05-08 12:34:58 +00:00
Martin Panter 129fe04d4d Issue #26512: Clarify Integral; tidy up table of rounding functions
Based on patch by Julien.
2016-05-08 12:22:37 +00:00
Berker Peksag a2570626c8 Issue #26898: Fix typo in math.isclose() docstring
Patch by Marco Buttu.
2016-05-01 11:27:59 +03:00
Berker Peksag d6e6f8b829 Issue #26898: Fix typo in math.isclose() docstring
Patch by Marco Buttu.
2016-05-01 11:27:37 +03:00
Brett Cannon 2f1a0b6ad5 Merge for issue #26114 2016-01-15 09:39:06 -08:00
Brett Cannon 45adb3100b Issue #26114: Remove a reference to 'Numerical Recipes'.
While no copyright violation occurred, the license which
'Numerical Recipes' operates under is not amenable to Python,
so to prevent confusion it's easier to simply remove its mention.
2016-01-15 09:38:24 -08:00
Serhiy Storchaka ef1585eb9a Issue #25923: Added more const qualifiers to signatures of static and private functions. 2015-12-25 20:01:53 +02:00
Tal Einat d5519ed7f4 Issue #19543: Implementation of isclose as per PEP 485
For details, see:
PEP 0485 -- A Function for testing approximate equality

Functions added: math.isclose() and cmath.isclose().

Original code by Chris Barker. Patch by Tal Einat.
2015-05-31 22:05:00 +03:00
Serhiy Storchaka 48e47aaa28 Issue #22486: Added the math.gcd() function. The fractions.gcd() function now is
deprecated.  Based on patch by Mark Dickinson.
2015-05-13 00:19:51 +03:00
Serhiy Storchaka c2ccce791c Issue #23641: Cleaned out legacy dunder names from tests and docs.
Fixed 2 to 3 porting bug in pynche.ColorDB.
Added few tests for __truediv__, __floordiv__ and __matmul__.
2015-03-12 22:01:30 +02:00
Serhiy Storchaka a60c2fe480 Issue #23641: Cleaned out legacy dunder names from tests and docs.
Fixed 2 to 3 porting bug in pynche.ColorDB.
2015-03-12 21:56:08 +02:00
Mark Dickinson cc8617b93a Issue #21092: Merge from 3.4. 2015-01-11 13:22:44 +00:00
Mark Dickinson dfe0b2326b Issue #21902: Replace incorrect 'hyperbolic arc sine' (etc.) with 'inverse hyperbolic sine' (etc.). Remove meaningless reference to radians. 2015-01-11 13:08:05 +00:00
Mark Dickinson a5d0c7c2fd Issue #23185: add math.inf and math.nan constants. 2015-01-11 11:55:29 +00:00
Victor Stinner 049e509a9f Issue #22207: Fix "comparison between signed and unsigned integers" warning in
test checking for integer overflow on Py_ssize_t type: cast explicitly to
size_t.
2014-08-17 22:20:00 +02:00
Mark Dickinson 5990d2864c Issue #20539: Improve math.factorial error messages and types for large inputs.
- Better message for the OverflowError in large positive inputs.
- Changed exception type from OverflowError to ValueError for large negative inputs.
2014-04-10 09:29:39 -04:00
Andrew Kuchling 3137885c36 #12211: remove paragraph about NaNs 2014-02-16 12:09:35 -05:00
Andrew Kuchling 8cb1ec3274 #12211: clarify math.copysign() documentation and docstring 2014-02-16 11:11:25 -05:00
Serhiy Storchaka 9594942716 Issue #18783: Removed existing mentions of Python long type in docstrings,
error messages and comments.
2013-08-27 19:40:23 +03:00
Mark Dickinson 039e0cdc28 Issue #16305: Merge fix from 3.2. 2012-10-25 10:47:46 +01:00
Mark Dickinson 76464494bc Fix math.factorial KeyboardInterrupt segfault. Thanks Amaury for report and diagnosis. 2012-10-25 10:46:28 +01:00
Benjamin Peterson 7d74b70e51 merge 3.2 2012-03-13 16:13:35 -05:00
Benjamin Peterson 2354a7593f fix indentation 2012-03-13 16:13:09 -05:00
Benjamin Peterson ce79852077 use the static identifier api for looking up special methods
I had to move the static identifier code from unicodeobject.h to object.h in
order for this to work.
2012-01-22 11:24:29 -05:00
Victor Stinner 639418812f Use the new Py_ARRAY_LENGTH macro 2011-09-29 00:42:28 +02:00
Mark Dickinson 50203a69b3 Return +-Py_HUGE_VAL for tgamma(+-0) instead of risking FP exceptions by computing 1.0 / 0.0. 2011-09-25 15:26:43 +01:00
Victor Stinner 8f9f8d612a Issue #11888: Use system log2() when available
I expect the system libc to use more accurate functions than Python. The GNU
libc uses for example FYL2X and FYL2XP1 hardware instructions on Intel FPU.
2011-05-09 12:45:41 +02:00
Mark Dickinson 83b8c0be93 Grammatical fix for a comment for log2, to avoid referring to an *algorithm* as monotonic. 2011-05-09 08:40:20 +01:00
Mark Dickinson 23442584f4 Fix cut-and-paste typo in comment: log10 -> log2. 2011-05-09 08:05:00 +01:00
Victor Stinner fa0e3d52d6 Issue #11888: Add log2 function to math module. Patch written by Mark
Dickinson.
2011-05-09 01:01:09 +02:00
Jesus Cea 736e7fc0f6 Issue #11495: OSF support is eliminated. It was deprecated in Python 3.2 2011-03-14 17:36:54 +01:00
Mark Dickinson c60371748b Issue #9599: Further accuracy tweaks to loghelper. For an integer n that's small enough to be converted to a float without overflow, log(n) is now computed as log(float(n)), and similarly for log10. 2010-09-29 19:06:36 +00:00
Mark Dickinson fa41e60c9d Issue #9599: Tweak loghelper algorithm to return slightly improved results for powers of 2. 2010-09-28 07:22:27 +00:00
Mark Dickinson 226f544caa Improve docstrings for isnan, isinf and isfinite. 2010-07-11 18:13:41 +00:00
Mark Dickinson 8e0c996873 Issue #9165: Add math.isfinite and cmath.isfinite. 2010-07-11 17:38:24 +00:00
Ezio Melotti 9527afd02c Fix typo in a comment in mathmodule.c. 2010-07-08 15:03:02 +00:00
Mark Dickinson be64d95169 Issue #9186: log1p(-1.0) should raise ValueError, not OverflowError. 2010-07-07 16:21:29 +00:00