From: "twooster (Tony Wooster)" Date: 2012-09-22T00:26:09+09:00 Subject: [ruby-core:47632] [ruby-trunk - Bug #7044][Open] BigDecimal#power randomly raises coercion errors Issue #7044 has been reported by twooster (Tony Wooster). ---------------------------------------- Bug #7044: BigDecimal#power randomly raises coercion errors https://bugs.ruby-lang.org/issues/7044 Author: twooster (Tony Wooster) Status: Open Priority: Normal Assignee: Category: Target version: ruby -v: ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux] 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: # 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 `
' (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. -- http://bugs.ruby-lang.org/