50 Commits
Author SHA1 Message Date
Jeong, YunWon f862b4bcee Fix Windows/x86 deallocation and sequence compatibility (#9427)
* Adopt pymath remainder fix on Windows

Pin pymath to the merged CPython-compatible remainder implementation and remove the passing Windows expected-failure marker.

Investigation, implementation, and validation assisted by Codex.

Assisted-by: Codex:GPT-5

* Keep deferred object deallocation iterative

Run deferred deallocators inside a guarded trashcan context so their end calls cannot recursively drain the same queue. Reset the depth on unwind and test the drain invariant. Fixes stack overflow while dropping deeply nested Element trees on Windows.

Investigation, implementation, validation, and focused review assisted by Codex.

Assisted-by: Codex:GPT-5

* Fix 32-bit sequence hashes, repetition errors, and range state

Use the declared 64-bit hash width for tuple hashing on every target, raise MemoryError for oversized sequence allocations, and preserve arbitrary-precision positions in long range iterators. Keep exhausted iterators exhausted instead of wrapping their counters.

Add Rust regression tests and verify the canonical Python suites with an optimized Windows x86 interpreter. Implementation, investigation, validation, and focused review assisted by Codex.

Assisted-by: Codex:GPT-5
2026-10-28 22:13:10 +09:00
youknowdot 0f127b07e9 Add Python 3.15 math APIs using pymath (#9122)
* Add Python 3.15 math APIs using pymath

Pin pymath to merged dd1e9a4cf26d68caf3b549c09476f52e356e16a3
and expose isnormal, issubnormal, signbit, fmax and fmin through thin
wrappers. Share the existing integer functions through math.integer
and _math_integer, matching CPython module identity and metadata.

Migrate test_math.py and test_math_integer.py via scripts/update_lib
from CPython d220409a13b77de7a6c30abe16ea90db01528edc, preserving the
existing Windows remainder marker. Add bounded Python snippet coverage.

AI assistance: OpenAI Codex implemented and source-reviewed this change,
ran update_lib, and performed focused automated validation. No human
manual testing is claimed.

Assisted-by: OpenAI Codex:model version unavailable

* Track integer math tests in library updates

Assisted-by: OpenAI Codex:model version unavailable
2026-10-15 10:02:44 +09:00
Shahar Naveh e71a955c99 Update some libs and tests to 3.14.7 (#8559)
* Update some libs

* Update some tests

* more tests

* test_pydoc.py

* test_mimetypes.py

* Restore json decoder

* reapply updaye
2026-08-23 00:13:15 +09:00
Shahar Naveh 292f66e051 Update some tests to 3.14.5 (#7909)
* Align patches for `test_class.py`

* Update more tests to 3.14.5

* Update `test_math`

* `test_hash.py`

* Update `test_grammar.py`

* Fix failing test

* Restore `test_grammar.py`
2026-05-19 13:31:33 +09:00
Shahar Naveh fca69f5b78 Remove some tests from PLATFORM_INDEPENDENT_TESTS (#7459)
* Remove some platform dependent tests

* Mark failing tests
2026-03-18 21:55:56 +09:00
Jeong, YunWon f9e2f9d273 Upgrade math,cmath to 3.14.2 and totally delegate to pymath (#6705)
* Upgrade test_math, test_cmath from 3.14.2

* pymath 0.1.5
2026-01-13 22:05:32 +09:00
Yash SutharandJeong, YunWon c6c931aa0b Fix ldexp to prevent math range errors (#6216)
* Fix ldexp to prevent math range errors

Implemented IEEE 754-compliant handling for large numbers to avoid
overflow and represent results using scientific notation.

Fixes #5471

Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>

* Fix ldexp to handle denormalized inputs correctly

Detect denormalized input values below f64::MIN_POSITIVE
Scale subnormal inputs by 2^54 to bring them into normalized range

Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>

* tests(math): remove expectedFailure from testLdexp_denormal

As now we have implemented IEEE 754 format , so this will pass.

Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>

* Update Lib/test/test_math.py

Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com>

* fixed formate in math.rs

Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>

---------

Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>
Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com>
2025-10-26 17:33:49 +09:00
ShaharNaveh 7e03ec7812 Update test_math 2025-08-23 22:06:50 +03:00
Karel Král 85f7ba51f4 Enable test_mtestfile 2025-05-02 03:39:46 +09:00
Jeong YunWon b0991e28a2 Replace puruspe to pymath
Might be lower quality, but better compatibility
2025-04-29 17:39:50 +09:00
Hanif Ariffin d800a6bb98 Update test_math from CPython 3.13.2 (#5610)
Implemnted fma in math module.
2025-04-05 14:53:40 +09:00
Hanif AriffinandJeong YunWon 65dcf1ce1c Updating test_math.py to CPython 3.12.9 (#5507)
* Fixed implementation against CPython 3.12.9 Lib/test/test_math.py tests
---------

Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
Co-authored-by: Jeong YunWon <jeong@youknowone.org>
2025-02-20 11:21:12 +09:00
Yongjin 3a13a7bfda update test_math.py from cpython 3.11.2 2023-03-25 15:21:41 +09:00
Devon Hollowood 3739372d43 Implement more accurate hypot()
This uses the improved-accuracy hypotenuse algorithm from Borges 2019,
see https://arxiv.org/abs/1904.09481.
2022-10-26 23:44:13 -07:00
Devon Hollowood dd5da766ab Clean up a few obsolete TODOs in test_math.py
It looks like these were accidentally left in the codebase after #2773.
2022-10-26 13:59:00 -07:00
Devon Hollowood 82b4990224 Use improved log2() implementation for log10()
This also fixes a bug in the log2() implementation, where very large
negative integer arguments would not raise an exception (and instead
would turn into NaNs).
2022-10-24 18:46:49 -07:00
Devon Hollowood beeb0441ef Allow log2() to work on large integers 2022-10-22 14:55:14 -07:00
Jeong YunWon 368e47cddb Merge pull request #4151 from jopemachine/add-cbrt
Add `math.cbrt` implemented in cpython 3.11
2022-09-12 13:55:56 +09:00
Gyubong e0f491ea8c Fix edge case of math.pow(0.0, -inf), math.pow(-0.0, -inf) 2022-09-12 12:45:56 +09:00
Gyubong 96fc308c04 Add math.cbrt
Update math.rs
2022-09-12 12:39:53 +09:00
Gyubong ea4f2e7bac Update test_math.py from CPython v3.12.0a0 2022-09-11 11:16:11 +09:00
Gyubong 1933e5f56e Add math.exp2 2022-09-08 17:00:42 +09:00
yyun-d 3070b19b36 Update test_math.py to cpython 3.10 2021-11-20 16:27:20 +09:00
Tetramad c88c69a993 Fix math.log1p to pass some failed tests
Now math.log1p with less than or equal to negative one should raise
ValueError with "math domain error" message
2021-10-25 14:44:13 +09:00
Tetramad ba3cafc932 Fix math.atanh to pass failed tests
Now math.atanh with out of domain value should raise ValueError with
"math domain error" message
2021-10-25 10:45:11 +09:00
Padraic Fanning bb1947eb9d Clarify skip in test_math 2021-10-15 00:09:50 +09:00
snpark 0c38ff5b89 fix: float_info is supported 2021-10-07 16:23:55 +09:00
Dongin Kim 1406f80c3c fix failed test remainder in test_math
add conditions for below rules

1. remainder(x, inf) is x, for non-NaN non-infinite x
2. According to IEEE 754-2008 7.2(f)
 2-1. remainder(x, 0) for non-NaN x is invalid operation
 2-2. remainder(infinity, x) for non-NaN x is invalid operation
2021-09-11 20:00:29 +09:00
voidSatisfaction e3f48bea95 Add math.dist function and enabled its tests (#2920)
Add math.dist function and enable its tests
2021-08-21 12:28:49 +03:00
Kim Dong In 6fa88ab05a Fix failed test pow in test_math
add two conditions to raise ValueError for input values
case 1: NaN, when both input values are finite, and base is negative and exponent is non-integer
case 2: divde by zero, when base is 0 exponent is negative value
2021-08-16 16:45:45 +09:00
voidSatisfaction 67ede59c32 Add math.prod function and enable its tests 2021-08-15 23:20:28 +09:00
leesungbinandJeong YunWon 2c6208a5f8 Add math_perm method
Co-authored-by: Jeong YunWon <youknowone@users.noreply.github.com>
2021-08-11 02:29:44 +09:00
voidSatisfaction 3cd1f6b27c Add math.comb function 2021-08-08 20:04:23 +09:00
jfh 53e8f5c17d Uncomment tests, mark the failing/need to skip. 2021-08-01 04:21:42 +03:00
Yossi Konstantinovsky e909f48f7e math: fix ldexp 2021-07-12 10:39:43 +03:00
Yossi Konstantinovsky 963e6e3df6 math: raise OverflowError when result is infinite
Matches CPython behavior.
2021-07-12 10:35:31 +03:00
Zach Silver 83de5bdf13 Unmark testFloor and testCeil failure 2021-02-15 16:34:53 -08:00
carbotaniuman 9faed3582a Address review 2020-12-21 22:29:15 -06:00
carbotaniuman 0ff37540ab Add fsum to the math module 2020-12-19 19:32:08 -06:00
hyperbora babebf0794 fix math.acosh 2020-10-31 00:26:18 +09:00
Noah e772b42f36 Fix a few math tests and implement nextafter in rust 2020-10-25 13:43:33 -05:00
Árni Dagur ab444d0a3e Correct value of sys.float_info.min 2020-10-22 18:30:51 +00:00
Árni Dagur da2bd5ea86 Implement math.ulp 2020-10-21 23:41:47 +00:00
Árni Dagur 72608545f3 Implement math.isqrt in Rust 2020-10-06 17:58:58 +00:00
hyperbora c6ea8f9907 fix math.acos and math.asin 2020-10-03 22:37:43 +09:00
hyperbora a1437a5be5 fix math.sqrt 2020-10-03 12:37:07 +09:00
Jeong YunWon 8e8efe0ec8 reform every TODO: RUSTPYTHON to same format 2020-06-17 18:47:13 +09:00
Noah 3ba023b738 Add todos in front of unittest.skip("RustPython") notes 2020-05-26 15:27:12 -05:00
TheAnyKey b7e91677a7 simplified implementation and commented tests 2020-05-10 20:53:09 +00:00
TheAnyKey ab9c2f2251 imported tests from cpython 3.6a5 for math. skipping all failing tests 2020-05-08 17:37:36 +00:00