Bug #8818

BigDecimal#power

Added by David Unric 8 months ago. Updated 5 months ago.

[ruby-core:56802]
Status:Closed
Priority:Normal
Assignee:Kenta Murata
Category:ext
Target version:2.1.0
ruby -v:1.9.3p448, 2.0.0p247 Backport:1.9.3: UNKNOWN, 2.0.0: UNKNOWN

Description

=begin
Optional argument `prec' to BigDecimal#power does not alter result precision:

b=BigDecimal.new("1.034482758620689655172413793103448275862068965517241379310344827586206896551724"
=> #
b.power(4,5)
=> #

expected result
=> #
=end

Associated revisions

Revision 43796
Added by Kenta Murata 5 months ago

  • ext/bigdecimal/bigdecimal.c (BigDecimal_power): Round the result value.
    [Bug #8818]

  • test/bigdecimal/test_bigdecimal.rb: Add a test for the above fix.

History

#1 Updated by Kenta Murata 8 months ago

  • Category changed from core to ext
  • Assignee set to Kenta Murata
  • Target version set to 2.1.0

#2 Updated by Kenta Murata 5 months ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r43796.
David, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • ext/bigdecimal/bigdecimal.c (BigDecimal_power): Round the result value.
    [Bug #8818]

  • test/bigdecimal/test_bigdecimal.rb: Add a test for the above fix.

Also available in: Atom PDF