Skip to content

Fix BigDecimal#power with negative integer#7887

Merged
enebo merged 3 commits intojruby:masterfrom
k77ch7:ruby-3.1-fix-bigdecimal-power
Aug 15, 2023
Merged

Fix BigDecimal#power with negative integer#7887
enebo merged 3 commits intojruby:masterfrom
k77ch7:ruby-3.1-fix-bigdecimal-power

Conversation

@k77ch7
Copy link
Contributor

@k77ch7 k77ch7 commented Aug 15, 2023

This commits improves precision of power algorithm.
This commits also updates getPrec() of private method to match MRI behavior.

The following test will pass.

  • test_power_without_prec in test/mri/bigdecimal/test_bigdecimal.rb

k77ch7 added 2 commits August 15, 2023 16:46
This commits improves precision of power algorithm.
This commits also updates getPrec() of private method to match MRI behavior.

The following test will pass.
 * test_power_without_prec in test/mri/bigdecimal/test_bigdecimal.rb
@k77ch7 k77ch7 marked this pull request as draft August 15, 2023 12:51
@k77ch7
Copy link
Contributor Author

k77ch7 commented Aug 15, 2023

These snippets match exactly with mri 3.1.3
BigDecimal("987654.3210987654321") ** -987
BigDecimal("0.00070809010203040506") ** -123

@k77ch7 k77ch7 marked this pull request as ready for review August 15, 2023 14:05
@enebo enebo added this to the JRuby 9.4.4.0 milestone Aug 15, 2023
@enebo enebo merged commit 4fc83fb into jruby:master Aug 15, 2023
@enebo
Copy link
Member

enebo commented Aug 15, 2023

Only 13 excludes left. Thanks @k77ch7.

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.

2 participants