Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Cast divmod quotient to int #312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
Loading
from
Open

Cast divmod quotient to int #312

wants to merge 3 commits into from

Conversation

mrzasa
Copy link
Contributor

@mrzasa mrzasa commented Feb 4, 2025

Changes

Cast the quotient of divmod to integer.

It seems to be reasonable to make this change on the last step - just before returning to the caller, not inside BigDecimal_DoDivmod. BigDecimal_DoDivmod is widely used in other places of the gem and changing its inteface would be cumbersome and risky.

Rationale

Float and Integer return an Integer as the first result of #divmod.

 pry(main)> 10.0.divmod(3)
=> [3, 1.0]
 pry(main)> 10.divmod(3)
=> [3, 1]

Fixes #262
Blocked by #313

@mrzasa mrzasa marked this pull request as ready for review February 4, 2025 22:07
@mrzasa
Copy link
Contributor Author

mrzasa commented Jun 9, 2025

It's green now, could I ask for a review?

@mrkn
Copy link
Member

mrkn commented Jun 18, 2025

@mrzasa We should consider the timing of merging this change into the master branch due to the incompatibility introduced. It should be v3.4 or v3.5. Wait a moment, please.

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.

I would expect BigDecimal#divmod to return type [Int, BigDecimal] (like Integer#divmod, Float#divmod)
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.