Serhiy Storchaka
5f4b229df7
bpo-40792: Make the result of PyNumber_Index() always having exact type int. (GH-20443)
...
Previously, the result could have been an instance of a subclass of int.
Also revert bpo-26202 and make attributes start, stop and step of the range
object having exact type int.
Add private function _PyNumber_Index() which preserves the old behavior
of PyNumber_Index() for performance to use it in the conversion functions
like PyLong_AsLong().
2020-05-28 10:33:45 +03:00
Serhiy Storchaka
578c3955e0
bpo-37999: No longer use __int__ in implicit integer conversions. (GH-15636)
...
Only __index__ should be used to make integer conversions lossless.
2020-05-26 18:43:38 +03:00
Dong-hee Na
5be8241392
bpo-1635741: Port math module to multiphase initialization (GH-19243)
2020-03-31 16:33:22 +02:00
Zackery Spytz
5208b4b379
bpo-39871: Fix possible SystemError in atan2, copysign and remainder (GH-18806)
...
In math_2(), the first PyFloat_AsDouble() call should be checked
for failure before the second call.
Co-authored-by: Mark Dickinson <dickinsm@gmail.com >
2020-03-14 10:45:32 +00:00
Serhiy Storchaka
559e7f165a
bpo-39648: Expand math.gcd() and math.lcm() to handle multiple arguments. (GH-18604)
...
* bpo-39648: Expand math.gcd() and math.lcm() to handle multiple arguments.
* Simplify fast path.
* Difine lcm() without arguments returning 1.
* Apply suggestions from code review
Co-Authored-By: Mark Dickinson <dickinsm@gmail.com >
Co-authored-by: Mark Dickinson <dickinsm@gmail.com >
2020-02-23 11:21:29 +00:00
ananthan-123
f2ee21d858
bpo-39479:Add math.lcm() function: Least Common Multiple ( #18547 )
...
* Update math.rst
* Update math.rst
* updated whats new
* Update test_math.py
* Update mathmodule.c
* Update mathmodule.c.h
* Update ACKS
* 📜 🤖 Added by blurb_it.
* Update 3.9.rst
* Update 2020-02-18-12-37-16.bpo-39479.j3UcCq.rst
* Update math.rst
* Update 2020-02-18-12-37-16.bpo-39479.j3UcCq.rst
* Update test_math.py
* Update ACKS
* Update mathmodule.c.h
* Update mathmodule.c
* Update mathmodule.c.h
* Update mathmodule.c.h
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2020-02-19 18:21:37 +00:00
Victor Stinner
e9e7d284c4
bpo-35081: Move dtoa.h header to the internal C API (GH-18489)
...
Move the dtoa.h header file to the internal C API as pycore_dtoa.h:
it only contains private functions (prefixed by "_Py").
The math and cmath modules must now be compiled with the
Py_BUILD_CORE macro defined.
2020-02-12 22:54:42 +01:00
Victor Stinner
85ead4fc62
bpo-39396: Fix math.nextafter(-0.0, +0.0) on AIX 7.1 (GH-18094)
...
Move also math.nextafter() on math.ulp() tests from IsCloseTests to
MathTests.
2020-01-21 11:14:10 +01:00
Niklas Fiekas
c5b79003f5
bpo-31031: Unify duplicate bits_in_digit and bit_length (GH-2866)
...
Add _Py_bit_length() to unify duplicate bits_in_digit() and bit_length().
2020-01-16 15:09:19 +01:00
Victor Stinner
0b2ab21956
bpo-39310: Add math.ulp(x) (GH-17965)
...
Add math.ulp(): return the value of the least significant bit
of a float.
2020-01-13 12:44:35 +01:00
Victor Stinner
100fafcf20
bpo-39288: Add math.nextafter(x, y) (GH-17937)
...
Return the next floating-point value after x towards y.
2020-01-12 02:15:42 +01:00
Victor Stinner
be143ec996
bpo-38835: Don't use PyFPE_START_PROTECT and PyFPE_END_PROTECT (GH-17231)
...
The PyFPE_START_PROTECT() and PyFPE_END_PROTECT() macros are empty:
they have been doing nothing for the last year (since commit
735ae8d139 ), so stop using them.
2019-11-20 02:51:30 +01:00
Serhiy Storchaka
5fd5cb8d85
bpo-38639: Optimize floor(), ceil() and trunc() for floats. (GH-16991)
2019-11-16 18:00:57 +02:00
Raymond Hettinger
6b5f1b496f
bpo-37691: Let math.dist() accept sequences and iterables for coordinates (GH-14975)
2019-07-27 14:04:29 -07:00
Mark Dickinson
014847034b
Fix inconsequential typo in math.remainder algorithm comments. ( #14746 )
2019-07-13 16:50:03 +01:00
Giovanni Cappellotto
dc3f99fa77
bpo-37548: Document range of atan, acos and asin (GH-14717)
2019-07-13 14:59:55 +01:00
Min ho Kim
f7d72e48fb
Fix some typos (GH-14435)
2019-07-05 14:39:32 -07:00
Serhiy Storchaka
231aad3849
bpo-37315: Deprecate accepting floats in math.factorial(). (GH-14147)
2019-06-17 16:57:27 +03:00
Mark Dickinson
2dfeaa9222
Turn math.isqrt assertion into a comment to clarify its purpose. (GH-14131)
2019-06-16 17:53:21 +01:00
Mark Dickinson
45e0411eee
Simplify negativity checks in math.comb and math.perm. (GH-13870)
2019-06-16 11:06:06 +01:00
Raymond Hettinger
e119b3d136
bpo-37178: Allow a one argument form of math.perm() (GH-13905)
2019-06-08 08:58:11 -07:00
Raymond Hettinger
963eb0f473
bpo-35431: Drop the k <= n requirement (GH-13798)
2019-06-04 01:23:06 -07:00
Serhiy Storchaka
5ae299ac78
bpo-37128: Add math.perm(). (GH-13731)
2019-06-02 11:16:49 +03:00
Serhiy Storchaka
2b843ac0ae
bpo-35431: Refactor math.comb() implementation. (GH-13725)
...
* Fixed some bugs.
* Added support for index-likes objects.
* Improved error messages.
* Cleaned up and optimized the code.
* Added more tests.
2019-06-01 22:09:02 +03:00
Yash Aggarwal
4a686504eb
bpo-35431: Implemented math.comb (GH-11414)
2019-06-01 00:21:27 -07:00