Actions
Bug #7044
closedBigDecimal#power randomly raises coercion errors
Description
When running the following code:
require 'bigdecimal'
10000.times { BigDecimal.new('1001.10')**0.75; putc '.' }
The call to ** will sometimes (not always) raise the following trace:
..............................................TypeError: #<Class:0x0000001cd78f40> can't be coerced into BigDecimal
from (irb):4:in `**'
from (irb):4:in `block in irb_binding'
from (irb):3:in `times'
from (irb):3
from /home/tony/.rbenv/versions/1.9.3-p194/bin/irb:12:in `<main>'
(The '.'s being the debug print of the putc.) I understand the documentation says only integer powers are supported for BigDecimal, however there is code support for floats and rationals, and it should fail or work reliably either way.
Actions