GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Cast divmod quotient to int by mrzasa · Pull Request #312 · ruby/bigdecimal

Conversation

@mrzasa

@mrzasa mrzasa commented Feb 4, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
mrzasa added 2 commits February 4, 2025 09:00
@mrzasa
Cast divmod quotient to int
7a86e95
@mrzasa
fixup! Cast divmod quotient to int
b8db4ad
@mrzasa
mrzasa marked this pull request as ready for review February 4, 2025 22:07
@mrzasa
Merge branch 'master' into divmod-int
7c1a6fd
@mrzasa

mrzasa commented Jun 9, 2025

Copy link
Copy Markdown
Contributor Author

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mrkn

mrkn commented Jun 18, 2025

Copy link
Copy Markdown
Member

@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.

mrzasa reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

tompng added 2 commits December 3, 2025 20:05
@tompng
Merge branch 'master' into divmod-int
14670a6
@tompng
Merge branch 'master' into divmod-int
2f9d3b6
@tompng

tompng commented Dec 3, 2025

Copy link
Copy Markdown
Member

Thank you for the fix. We're planning to release a new version including this breaking change as v4.0.0 (major version up) in this month.

mrzasa reacted with thumbs up emoji mrzasa reacted with laugh emoji mrzasa reacted with hooray emoji
All reactions
  • 👍 1 reaction
  • 😄 1 reaction
  • 🎉 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tompng
tompng merged commit 150d01d into ruby:master Dec 3, 2025
ksss added a commit to ksss/rbs that referenced this pull request Dec 17, 2025
@ksss
Fix BigDecimal#divmod
85ba59b
One of the supporting for BigDecimal v4
See also: ruby/bigdecimal#312
ksss added a commit to ksss/rbs that referenced this pull request Dec 17, 2025
@ksss
Fix BigDecimal#divmod
293f61a
One of the supporting for BigDecimal v4
See also: ruby/bigdecimal#312
@dduugg dduugg mentioned this pull request Dec 30, 2025
Update types for bigdecimal 4 sorbet/sorbet#9803
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

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)

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@mrzasa @mrkn @tompng
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.