summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_math.py
Commit message (Collapse)AuthorAgeFilesLines
* gh-127146: Resolve some minor problems in Emscripten tests (#127565)Hood Chatham2024-12-041-1/+1
| | | | Adjusts some Emscripten test exclusions regarding strftime, fma, and stack depth.
* gh-125522: Fix bare except in test_math.testTan (#125544)Irit Katriel2024-10-191-1/+1
|
* gh-125150: Skip test_fma_zero_result on NetBSD due to IEE 754-2008 ↵Furkan Onder2024-10-091-1/+1
| | | | | implementation issues (#125151) Skip test_fma_zero_result on NetBSD due to IEE 754-2008 implementation issues
* gh-124040: Adjust few tests in testHypot/testDist to get exactly computed ↵Sergey B Kirpichev2024-09-191-6/+8
| | | | results (GH-124042)
* gh-123836: Check zero signs in math_testcases.txt (#123854)Sergey B Kirpichev2024-09-171-0/+10
| | | | | Just like cmath_testcases.txt. These tests require IEEE 754 anyway. Correct zero sign for sqrt tests to match math.h convention.
* Fix typos (#123775)algonell2024-09-091-1/+1
|
* gh-121485: Always use 64-bit integers for integers bits count (GH-121486)Serhiy Storchaka2024-08-301-0/+16
| | | | | Use 64-bit integers instead of platform specific size_t or Py_ssize_t to represent the number of bits in Python integer.
* gh-118671: Updated dead ActiveState links (#118730)trag1c2024-05-081-1/+1
| | | | | Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
* gh-116622: Test updates for Android (#117299)Malcolm Smith2024-04-051-5/+5
| | | | | | | - re-enable test_fcntl_64_bit on Linux aarch64, but disable it on all Android ABIs - use support.setswitchinterval in all relevant tests - skip test_fma_zero_result on Android x86_64 - accept EACCES when calling os.get_terminal_size on Android
* gh-73468: Add math.fma() function (#116667)Victor Stinner2024-03-171-0/+238
| | | | | | Added new math.fma() function, wrapping C99's ``fma()`` operation: fused multiply-add function. Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
* gh-102837: more tests for the math module (GH-111930)Sergey B Kirpichev2023-11-131-0/+55
| | | | | | | | | | | | | | Add tests to improve coverage: * fsum: L1369, L1379, L1383, L1412 * trunc: L2081 * log: L2267 * dist: L2577, L2579 * hypot: L2632 * sumprod: L2744, L2754, L2774, L2778, L2781, L2785, L2831, L2835, L2838 * pow: L2982 * prod: L3294, L3308, L3318-3330 // line numbers wrt to 9dc4fb8204
* gh-111342: fix typo in math.sumprod (GH-111416)Sergey B Kirpichev2023-10-281-0/+1
|
* gh-108303: Move all math files to `Lib/test/mathdata/` (#109512)Nikita Sobolev2023-09-211-3/+3
|
* gh-102837: improve test coverage for math module (#102523)Sergey B Kirpichev2023-09-031-0/+41
| | | | | | | | - input checks for math_1(L989), math_1a(L1023), math_2(L1064,L1071), hypot(L2682), log(L2307), ldexp(L2168), ceil(L1165), floor(L1236,L1239) and dist(L2587,L2588,L2628). - drop inaccessible "if" branch (L3518) in perm_comb_small() - improve fsum coverage for exceptional cases (L1433,L1438,L1451,L1497), ditto fmod(L2378) - rewrite modf to fix inaccessible case(L2229), ditto for pow(L2988) (all line numbers are wrt the main branch at 5e6661bce9)
* gh-94906: Support multiple steps in math.nextafter (#103881)Matthias Görgens2023-05-191-3/+17
| | | | | | | This PR updates `math.nextafter` to add a new `steps` argument. The behaviour is as though `math.nextafter` had been called `steps` times in succession. --------- Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
* gh-104263: Rely on Py_NAN and introduce Py_INFINITY (GH-104202)Sebastian Berg2023-05-101-2/+2
| | | | | | | | | | This PR removes `_Py_dg_stdnan` and `_Py_dg_infinity` in favour of using the standard `NAN` and `INFINITY` macros provided by C99. This change has the side-effect of fixing a bug on MIPS where the hard-coded value used by `_Py_dg_stdnan` gave a signalling NaN rather than a quiet NaN. --------- Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
* Revert "gh-89381: Fix invalid signatures of math/cmath.log (#101404)" (#101580)Mark Dickinson2023-02-051-1/+0
| | | This reverts commit 0ef92d979311ba82d4c41b22ef38e12e1b08b13d.
* GH-100485: Create an alternative code path when an accurate fma() ↵Raymond Hettinger2023-02-041-0/+5
| | | | implementation is not available (#101567)
* gh-89381: Fix invalid signatures of math/cmath.log (#101404)Sergey B Kirpichev2023-01-291-0/+1
|
* GH-100485: Add extended accuracy test. Switch to faster fma() based ↵Raymond Hettinger2023-01-281-0/+83
| | | | variant. GH-101383)
* GH-100485: Tweaks to sumprod() (GH-100857)Raymond Hettinger2023-01-081-0/+1
|
* GH-100485: Add math.sumprod() (GH-100677)Raymond Hettinger2023-01-071-0/+166
|
* GH-98897: fix memory leak if `math.dist` raises exception (GH-98898)Kumar Aditya2022-11-011-0/+5
|
* bpo-37295: Use constant-time comb() and perm() for larger n depending on k ↵Serhiy Storchaka2022-01-091-4/+4
| | | | (GH-30305)
* bpo-45917: Add math.exp2() method - return 2 raised to the power of x (GH-29829)Gideon2021-11-291-0/+11
| | | Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
* bpo-35606: Fix math.prod tests using 'start' as keyword parameter (GH-28595)Pablo Galindo Salgado2021-09-281-6/+12
|
* bpo-5846: Do not use obsolete unittest functions. (GH-28303)Serhiy Storchaka2021-09-131-8/+5
| | | | Get rid of use of makeSuite() and findTestCases(). Also make test_math and test_threading_local discoverable.
* bpo-44339: Fix math.pow corner case to comply with IEEE 754 (GH-26606)Mark Dickinson2021-06-121-2/+2
| | | Change the behaviour of `math.pow(0.0, -math.inf)` and `math.pow(-0.0, -math.inf)` to return positive infinity instead of raising `ValueError`. This makes `math.pow` consistent with the built-in `pow` (and the `**` operator) for this particular special case, and brings the `math.pow` special-case handling into compliance with IEEE 754.
* bpo-44357:Add `math.cbrt()` function: Cube Root (GH-26622)Ajith Ramachandran2021-06-101-0/+16
| | | | | | * Add math.cbrt() function: Cube Root Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
* bpo-44364:Add non integral tests for `sqrt()` (#26625)Ajith Ramachandran2021-06-101-0/+4
| | | | | * Add non integral tests for `sqrt()` Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
* bpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25145)Inada Naoki2021-04-041-2/+2
| | | | | | | | | | | | | | | | | | | * test_asyncio * test_bz2 * test_math * test_cmath * test_cmd_line * test_cmd_line_script * test_compile * test_contextlib * test_profile * ctypes/test/test_find * test_multiprocessing * test_configparser * test_csv * test_dbm_dumb * test_decimal * test_difflib * os.fdopen() calls io.text_encoding() to emit EncodingWarning for right place.
* Revert "Fix all Python Cookbook links (#22205)" (GH-22424)Andre Delfino2020-09-271-1/+1
| | | This commit reverts commit ac0333e1e117b7f61ed7ef1dbcdb6e515ada603b as the original links are working again and they provide extended features such as comments and alternative versions.
* bpo-41513: Add accuracy tests for math.hypot() (GH-22327)Raymond Hettinger2020-09-211-0/+63
|
* Fix all Python Cookbook links (#22205)Andre Delfino2020-09-151-1/+1
|
* bpo-41513: Remove broken tests that fail on Gentoo (GH-22249)Raymond Hettinger2020-09-151-51/+0
|
* bpo-41513: Add docs and tests for hypot() (GH-22238)Raymond Hettinger2020-09-141-0/+51
|
* bpo-41513: Improve speed and accuracy of math.hypot() (GH-21803)Raymond Hettinger2020-08-161-3/+4
|
* bpo-37999: No longer use __int__ in implicit integer conversions. (GH-15636)Serhiy Storchaka2020-05-261-10/+5
| | | | Only __index__ should be used to make integer conversions lossless.
* bpo-39871: Fix possible SystemError in atan2, copysign and remainder (GH-18806)Zackery Spytz2020-03-141-0/+16
| | | | | | 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>
* bpo-39648: Expand math.gcd() and math.lcm() to handle multiple arguments. ↵Serhiy Storchaka2020-02-231-25/+33
| | | | | | | | | | | | | | | | (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>
* bpo-39479:Add math.lcm() function: Least Common Multiple (#18547)ananthan-1232020-02-191-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Move test_math tests (GH-18098)Victor Stinner2020-01-211-148/+148
| | | | | testPerm() and testComb() belong to MathTests, not to IsCloseTests(). test_nextafter() and test_ulp() now use assertIsNaN().
* bpo-39396: Fix math.nextafter(-0.0, +0.0) on AIX 7.1 (GH-18094)Victor Stinner2020-01-211-77/+77
| | | | Move also math.nextafter() on math.ulp() tests from IsCloseTests to MathTests.
* bpo-39310: Add math.ulp(x) (GH-17965)Victor Stinner2020-01-131-28/+27
| | | | Add math.ulp(): return the value of the least significant bit of a float.
* bpo-39288: Add math.nextafter(x, y) (GH-17937)Victor Stinner2020-01-121-0/+54
| | | Return the next floating-point value after x towards y.
* bpo-38992: avoid fsum test failure from constant-folding (GH-17513)Mark Dickinson2019-12-091-1/+7
| | | | | | * Issue 38992: avoid fsum test failure * Add NEWS entry
* bpo-38639: Optimize floor(), ceil() and trunc() for floats. (GH-16991)Serhiy Storchaka2019-11-161-21/+40
|
* bpo-37691: Let math.dist() accept sequences and iterables for coordinates ↵Raymond Hettinger2019-07-271-2/+4
| | | | (GH-14975)
* Fix typos in docs, comments and test assert messages (#14872)Min ho Kim2019-07-211-2/+2
|
* Remove unused imports in tests (GH-14518)Victor Stinner2019-07-011-1/+1
|