Skip to content

Closes 5113, fixing behavior of floor division operator (//) - #5131

Merged
ajpotts merged 1 commit into
Bears-R-Us:mainfrom
drculhane:Closes-5113
Jan 16, 2026
Merged

ajpotts merged 1 commit into
Bears-R-Us:mainfrom
drculhane:Closes-5113

Conversation

@drculhane

@drculhane drculhane commented Dec 9, 2025 •

Copy link
Copy Markdown
Contributor

Closes #5113

Update -- after a chat with Ryan, I realized that it wasn't really enough to correct the behavior of // without also distributing it. So this version does that, with a new function called floorDivision, which calls a slightly changed floorDivisionHelper.

There are three versions of floorDivision, for the vv, vs and sv cases.

All of the calls to floorDivisionHelper in BinOp, which were zippered foralls, now call floorDivision.

I also changed the calls to floorDivisionHelper in TimeClassMsg.chpl and OperatorMsg.chpl.

Also at Ryan's suggestion, I removed "inline" from the declaration of floorDivisionHelper. I haven't yet addressed ModHelper. That will be in the PR for the behavior of the % operator.


Previously -- I modified floorDivisionHelper to handle more data types, and invoked it in places where chapel had been performing a simple (and incorrect) a/b division.

@ajpotts ajpotts left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

I noticed division by zero doesn't match NumPy still, but I created a separate issue:#5132

@1RyanK 1RyanK left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the PR is mostly correct, just a bit of a concern here.

Comment thread src/BinOp.chpl Resolved
Comment thread src/BinOp.chpl Resolved
@codecov

codecov Bot commented Jan 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@0b2d554). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff            @@
##             main     #5131   +/-   ##
========================================
  Coverage        ?   100.00%           
========================================
  Files           ?         4           
  Lines           ?        63           
  Branches        ?         0           
========================================
  Hits            ?        63           
  Misses          ?         0           
  Partials        ?         0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jaketrookman jaketrookman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@ajpotts
ajpotts added this pull request to the merge queue Jan 16, 2026
Merged via the queue into Bears-R-Us:main with commit be6b999 Jan 16, 2026
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.

Bug Report: Integer Floor Division (//) Misalignment Between Arkouda and NumPy

4 participants