Skip to content

Handle correctly #reminder with infinity. Fixes #187 #243

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

Merged
merged 1 commit into from
Feb 17, 2023

Conversation

mrzasa
Copy link
Contributor

@mrzasa mrzasa commented Nov 30, 2022

Fixes #187 by adding a guard to BigDecimal_divremain. This returns early if the divider is infinity.

@mrzasa mrzasa force-pushed the modulus-reminder-infinity branch 2 times, most recently from 575dac0 to 5dd86f1 Compare November 30, 2022 21:42
@mrzasa mrzasa marked this pull request as ready for review November 30, 2022 21:44
@mrzasa mrzasa force-pushed the modulus-reminder-infinity branch 2 times, most recently from ee1f515 to 5675a01 Compare December 16, 2022 15:48
@mrzasa mrzasa force-pushed the modulus-reminder-infinity branch 2 times, most recently from 75fcdc6 to 31cdd32 Compare January 13, 2023 23:17
@mrzasa mrzasa force-pushed the modulus-reminder-infinity branch from 31cdd32 to 21b996b Compare January 13, 2023 23:18
@mrzasa
Copy link
Contributor Author

mrzasa commented Feb 16, 2023

@mrkn could you take a look? I believe it's ready for review now

@mrkn mrkn merged commit 4b8572d into ruby:master Feb 17, 2023
@mrkn
Copy link
Member

mrkn commented Feb 17, 2023

@mrzasa Thank you!

k0kubun added a commit to ruby/ruby that referenced this pull request Feb 17, 2023
This test is no longer passing:
```
  1)
  BigDecimal#remainder returns NaN if Infinity is involved FAILED
  Expected Infinity.nan?
  to be truthy but was false
  /home/runner/work/ruby/ruby/src/spec/ruby/library/bigdecimal/remainder_spec.rb:58:in `block (2 levels) in <top (required)>'
  /home/runner/work/ruby/ruby/src/spec/ruby/library/bigdecimal/remainder_spec.rb:4:in `<top (required)>'
```

ruby/bigdecimal#243
@nobu
Copy link
Member

nobu commented Feb 19, 2023

Doesn't this need to bump the version?
I think this guard should use BigDecimal::VERSION instead of RUBY_VERSION.

eregon pushed a commit to ruby/spec that referenced this pull request Feb 27, 2023
This test is no longer passing:
```
  1)
  BigDecimal#remainder returns NaN if Infinity is involved FAILED
  Expected Infinity.nan?
  to be truthy but was false
  /home/runner/work/ruby/ruby/src/spec/ruby/library/bigdecimal/remainder_spec.rb:58:in `block (2 levels) in <top (required)>'
  /home/runner/work/ruby/ruby/src/spec/ruby/library/bigdecimal/remainder_spec.rb:4:in `<top (required)>'
```

ruby/bigdecimal#243
seven1m pushed a commit to seven1m/ruby_spec that referenced this pull request Sep 2, 2023
This test is no longer passing:
```
  1)
  BigDecimal#remainder returns NaN if Infinity is involved FAILED
  Expected Infinity.nan?
  to be truthy but was false
  /home/runner/work/ruby/ruby/src/spec/ruby/library/bigdecimal/remainder_spec.rb:58:in `block (2 levels) in <top (required)>'
  /home/runner/work/ruby/ruby/src/spec/ruby/library/bigdecimal/remainder_spec.rb:4:in `<top (required)>'
```

ruby/bigdecimal#243
headius pushed a commit to headius/spec that referenced this pull request Oct 31, 2024
This test is no longer passing:
```
  1)
  BigDecimal#remainder returns NaN if Infinity is involved FAILED
  Expected Infinity.nan?
  to be truthy but was false
  /home/runner/work/ruby/ruby/src/spec/ruby/library/bigdecimal/remainder_spec.rb:58:in `block (2 levels) in <top (required)>'
  /home/runner/work/ruby/ruby/src/spec/ruby/library/bigdecimal/remainder_spec.rb:4:in `<top (required)>'
```

ruby/bigdecimal#243
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.

Adjust modulus/remainder calculation for infinity arguments
3 participants