Project

General

Profile

Actions

Bug #8818

closed

BigDecimal#power

Added by dunric (David Unric) about 11 years ago. Updated almost 11 years ago.

Status:
Closed
Target version:
ruby -v:
1.9.3p448, 2.0.0p247
[ruby-core:56802]

Description

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

b=BigDecimal.new("1.034482758620689655172413793103448275862068965517241379310344827586206896551724"
=> #<BigDecimal:807a50,'0.1034482758 6206896551 7241379310 3448275862 0689655172 4137931034 4827586206 896551724E1',90(90)>
b.power(4,5)
=> #<BigDecimal:10bb958,'0.1145230820 5649522608 4116496837 8904565512 1514645522 7837309357 9496692262 3398620909 7657083959 5577995167 4087102580 1626227765 2022322103 9445425509 8044483027 2550796764 5108521224 2376085318 2822668783 6941752994 9199822984 0756361333 0486751376 0443160825 7538375836 4780052058 5170533352 3733848357 3007050945 8051326134 8742578974 976E1',324(513)>

expected result
=> #BigDecimal:110f508,'0.11453E1',18(27)
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0