summaryrefslogtreecommitdiffstats
path: root/Modules/mathmodule.c
Commit message (Collapse)AuthorAgeFilesLines
* Move float conversion into a macro. Apply to fsum (GH-11698)Raymond Hettinger2019-01-301-49/+32
|
* Fast path for int inputs to math.dist() and math.hypot() (GH-11692)Raymond Hettinger2019-01-281-3/+24
|
* bpo-35719: Optimize multi-argument math functions. (GH-11527)Serhiy Storchaka2019-01-121-19/+18
| | | | | Use the fast call convention for math functions atan2(), copysign(), hypot() and remainder() and inline unpacking arguments. This sped up them by 1.3--2.5 times.
* bpo-34838: Use subclass_of for math.dist. (GH-9659)Ammar Askar2019-01-121-8/+3
| | | | | Argument clinic now generates fast inline code for positional parsing, so the manually implemented type check in math.dist can be removed.
* bpo-35436: Add missing PyErr_NoMemory() calls and other minor bug fixes. ↵Zackery Spytz2018-12-071-3/+4
| | | | | | (GH-11015) Set MemoryError when appropriate, add missing failure checks, and fix some potential leaks.
* Fixing wording in comment. (GH-10425)Raymond Hettinger2018-11-091-1/+1
| | | | Since the n==1 case just returns *max*, it cannot be larger than the magnitude of the vector entry.
* Speed-up math.dist() by 30% (GH-9628)Raymond Hettinger2018-09-291-3/+8
|
* bpo-33083 - Make math.factorial reject arguments that are not int-like (GH-6149)Pablo Galindo2018-09-031-3/+9
| | | math.factorial() was accepting non-integral Decimal instances. This is inconsistent with the actual behaviour for floats, which are not accepted.
* Minor improvement to code clarity (GH-9036)Raymond Hettinger2018-09-021-1/+1
| | | Make it clear that the n==0 case is included. Otherwise, you have to know that max==0.0 whenever n==0.
* Simplify vector_norm() by eliminating special cases in the main loop (GH-9006)Raymond Hettinger2018-08-311-22/+18
| | | The *max* value is no longer treated as a special case in the main loop. Besides making the main loop simpler and branchless, this also lets us relax the input restriction of *vec* to contain only non-negative values.
* Improve commutativity of math.hypot() and math.dist() (GH-8984)Raymond Hettinger2018-08-291-13/+19
|
* Fast path for exact floats in math.hypot() and math.dist() (GH-8949)Raymond Hettinger2018-08-271-9/+21
|
* Minor code clean-up. Don't alter the input vector. Use variables instead. ↵Raymond Hettinger2018-08-121-4/+5
| | | | GH-8748
* Add more tests and assertions for math.hypot() and math.dist() (GH-8747)Raymond Hettinger2018-08-121-0/+1
|
* Factor-out common code. Also, optimize common cases by preallocating space ↵Raymond Hettinger2018-08-121-41/+56
| | | | | on the stack. GH-8738 Improves speed by 9 to 10ns per call.
* Replace straight addition with Kahan summation and move max to the end (GH-8727)Raymond Hettinger2018-08-111-20/+45
|
* bpo-33089: Add math.dist() for computing the Euclidean distance between two ↵Raymond Hettinger2018-07-311-0/+84
| | | | points (GH-8561)
* bpo-33089: Multidimensional math.hypot() (GH-8474)Raymond Hettinger2018-07-281-38/+63
|
* bpo-31338 (#3374)Barry Warsaw2017-09-151-2/+1
| | | | | | | * 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.
* bpo-29962: add math.remainder (#950)Mark Dickinson2017-04-051-0/+103
| | | | | | | | | | | | | | * 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.
* bpo-29946: Fix "sqrtpi defined but not used" (#908)Louie Lu2017-03-301-1/+3
|
* bpo-26121: Revert to using the own implementations of lgamma and gamma on ↵Serhiy Storchaka2017-03-121-31/+0
| | | | all platforms. (#637)
* bpo-26121: Use C library implementation for math functions: (#515)Serhiy Storchaka2017-03-111-1/+45
| | | | | | | * 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.
* Issue #29282: Backed out changeset b33012ef1417Mark Dickinson2017-01-211-42/+0
|
* Issue #29282: add fused multiply-add function, math.fma.Mark Dickinson2017-01-211-0/+42
|
* Issue #20186: Converted the math module to Argument Clinic.Serhiy Storchaka2017-01-191-247/+384
| | | | Patch by Tal Einat.
* Use _PyObject_CallNoArg()Victor Stinner2016-12-061-3/+3
| | | | | | | Replace: PyObject_CallFunctionObjArgs(callable, NULL) with: _PyObject_CallNoArg(callable)
* Backed out changeset b9c9691c72c5Victor Stinner2016-12-041-3/+3
| | | | | | Issue #28858: The change b9c9691c72c5 introduced a regression. It seems like _PyObject_CallArg1() uses more stack memory than PyObject_CallFunctionObjArgs().
* Replace PyObject_CallFunctionObjArgs() with fastcallVictor Stinner2016-12-011-3/+3
| | | | | | | | | | | | | | * 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.
* Issue #27895: Spelling fixes (Contributed by Ville Skyttä).Raymond Hettinger2016-08-301-1/+1
|
* Issue #12345: Add mathemathcal constant tau to math and cmath.Guido van Rossum2016-08-151-0/+1
| | | | Patch by Lisa Roach. See also PEP 628.
* Issue #26512: Merge rounding doc from 3.5Martin Panter2016-05-081-4/+4
|\
| * Issue #26512: Clarify Integral; tidy up table of rounding functionsMartin Panter2016-05-081-4/+4
| | | | | | | | Based on patch by Julien.
* | Issue #26898: Fix typo in math.isclose() docstringBerker Peksag2016-05-011-1/+1
|\ \ | |/ | | | | Patch by Marco Buttu.
| * Issue #26898: Fix typo in math.isclose() docstringBerker Peksag2016-05-011-1/+1
| | | | | | | | Patch by Marco Buttu.
* | Merge for issue #26114Brett Cannon2016-01-151-3/+2
|\ \ | |/
| * Issue #26114: Remove a reference to 'Numerical Recipes'.Brett Cannon2016-01-151-3/+2
| | | | | | | | | | | | 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.
* | Issue #25923: Added more const qualifiers to signatures of static and ↵Serhiy Storchaka2015-12-251-2/+2
|/ | | | private functions.
* Issue #19543: Implementation of isclose as per PEP 485Tal Einat2015-05-311-0/+79
| | | | | | | | | 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.
* Issue #22486: Added the math.gcd() function. The fractions.gcd() function ↵Serhiy Storchaka2015-05-121-0/+28
| | | | | | now is deprecated. Based on patch by Mark Dickinson.
* Issue #23641: Cleaned out legacy dunder names from tests and docs.Serhiy Storchaka2015-03-121-1/+1
|\ | | | | | | | | Fixed 2 to 3 porting bug in pynche.ColorDB. Added few tests for __truediv__, __floordiv__ and __matmul__.
| * Issue #23641: Cleaned out legacy dunder names from tests and docs.Serhiy Storchaka2015-03-121-1/+1
| | | | | | | | Fixed 2 to 3 porting bug in pynche.ColorDB.
* | Issue #21092: Merge from 3.4.Mark Dickinson2015-01-111-3/+3
|\ \ | |/
| * Issue #21902: Replace incorrect 'hyperbolic arc sine' (etc.) with 'inverse ↵Mark Dickinson2015-01-111-3/+3
| | | | | | | | hyperbolic sine' (etc.). Remove meaningless reference to radians.
* | Issue #23185: add math.inf and math.nan constants.Mark Dickinson2015-01-111-1/+34
| |
* | Issue #22207: Fix "comparison between signed and unsigned integers" warning inVictor Stinner2014-08-171-1/+1
| | | | | | | | | | test checking for integer overflow on Py_ssize_t type: cast explicitly to size_t.
* | Issue #20539: Improve math.factorial error messages and types for large inputs.Mark Dickinson2014-04-101-4/+12
|/ | | | | - Better message for the OverflowError in large positive inputs. - Changed exception type from OverflowError to ValueError for large negative inputs.
* #12211: remove paragraph about NaNsAndrew Kuchling2014-02-161-3/+1
|
* #12211: clarify math.copysign() documentation and docstringAndrew Kuchling2014-02-161-1/+5
|
* Issue #18783: Removed existing mentions of Python long type in docstrings,Serhiy Storchaka2013-08-271-7/+6
| | | | error messages and comments.