Skip to content

Remove m_remainder() - #158826

Closed
skirpichev wants to merge 1 commit into
python:mainfrom
skirpichev:remove-m_remainder
Closed

skirpichev wants to merge 1 commit into
python:mainfrom
skirpichev:remove-m_remainder

Conversation

@skirpichev

Copy link
Copy Markdown
Member

No description provided.

@skirpichev skirpichev added DO-NOT-MERGE 🔨 test-with-buildbots Test PR w/ buildbots; report in status section labels Oct 5, 2026
@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @skirpichev for commit a18af12 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F158826%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Oct 5, 2026
@picnixz

picnixz commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Can we have an issue about replacing our remainder with C math remainder?

@skirpichev

Copy link
Copy Markdown
Member Author

replacing our remainder with C math remainder?

It looks like it's already completely broken for Window$ (Tier 1) and Android (Tier 3). (In #101679 I did similar attempt for lgamma/tgamma. IIRIC, tests were broken on Win/Mac.)

So, it's not ready yet. Though, maybe it's a good idea to document why we need this implementation, with a list of broken platforms... For m_log*() functions things now might be better.

@skirpichev

Copy link
Copy Markdown
Member Author

Failures:

  1. For buildbot/aarch64 Android PR (same for amd64):
FAIL: testRemainder (test.test_math.MathTests.testRemainder)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/data/user/0/org.python.testbed/files/python/lib/python3.16/test/test_math.py", line 1858, in testRemainder
    validate_spec(x, y, actual)
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "/data/user/0/org.python.testbed/files/python/lib/python3.16/test/test_math.py", line 1770, in validate_spec
    self.assertEqual(n, int(n))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^
AssertionError: Fraction(-1, 25) != 0
  1. On Windows, e.g. buildbot/AMD64 Windows10 PR:
FAIL: testRemainder (test.test_math.MathTests.testRemainder)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\buildarea\pull_request.bolen-windows10\build\Lib\test\test_math.py", line 1858, in testRemainder
    validate_spec(x, y, actual)
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "D:\buildarea\pull_request.bolen-windows10\build\Lib\test\test_math.py", line 1767, in validate_spec
    self.assertLessEqual(abs(fr), abs(fy/2))
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
AssertionError: Fraction(3, 50600563326827654588123836679729326762389162441035529589225339506857584891998836722990095925359281123796769466079202977847452184346448369216753349985184627480379356069141590341116726935523304085309941919618186267140501870856173174654525838912289889085202514128089692388083353653807625633046581877161501565826926935273373696) not less than or equal to Fraction(23, 404804506614621236704990693437834614099113299528284236713802716054860679135990693783920767402874248990374155728633623822779617474771586953734026799881477019843034848553132722728933815484186432682479535356945490137124014966849385397236206711298319112681620113024717539104666829230461005064372655017292012526615415482186989568)

or on x32:

FAIL: testRemainder (test.test_math.MathTests.testRemainder)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\a\cpython\cpython\Lib\test\test_math.py", line 1858, in testRemainder
    validate_spec(x, y, actual)
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "D:\a\cpython\cpython\Lib\test\test_math.py", line 1767, in validate_spec
    self.assertLessEqual(abs(fr), abs(fy/2))
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
AssertionError: Fraction(13, 202402253307310618352495346718917307049556649764142118356901358027430339567995346891960383701437124495187077864316811911389808737385793476867013399940738509921517424276566361364466907742093216341239767678472745068562007483424692698618103355649159556340810056512358769552333414615230502532186327508646006263307707741093494784) not less than or equal to Fraction(25, 404804506614621236704990693437834614099113299528284236713802716054860679135990693783920767402874248990374155728633623822779617474771586953734026799881477019843034848553132722728933815484186432682479535356945490137124014966849385397236206711298319112681620113024717539104666829230461005064372655017292012526615415482186989568)

BTW, I think it will be a good idea to modernize math tests (including above example) with using subTest method or subTests decorator.

@skirpichev skirpichev closed this Oct 6, 2026
@skirpichev
skirpichev deleted the remove-m_remainder branch October 6, 2026 02:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants