From: "marcandre (Marc-Andre Lafortune)" Date: 2013-11-11T01:42:55+09:00 Subject: [ruby-core:58255] [ruby-trunk - Bug #8958] Rational#to_d don't match documentation Issue #8958 has been updated by marcandre (Marc-Andre Lafortune). @mrkn I'm not sure it would make sense to have a default precision here... Is there a default precision anywhere in the BigDecimal library? ---------------------------------------- Bug #8958: Rational#to_d don't match documentation https://bugs.ruby-lang.org/issues/8958#change-42846 Author: ejfinneran (E.J. Finneran) Status: Assigned Priority: Normal Assignee: zzak (Zachary Scott) Category: doc Target version: ruby -v: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.5.0] Backport: The documentation states that Rational#to_d (added by BigDecimal) has an optional parameter to limit the precision. However, that parameter is not optional as implemented. http://www.ruby-doc.org/stdlib-2.0.0/libdoc/bigdecimal/rdoc/Rational.html ��������� ruby -v ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.5.0] ��������� irb 2.0.0p247 :001 > require 'bigdecimal' => true 2.0.0p247 :002 > require 'bigdecimal/util' => true 2.0.0p247 :003 > 3.to_r.to_d ArgumentError: wrong number of arguments (0 for 1) from /Users/ej/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/bigdecimal/util.rb:98:in `to_d' from (irb):3 from /Users/ej/.rvm/rubies/ruby-2.0.0-p247/bin/irb:16:in `
' 2.0.0p247 :004 > 3.to_r.to_d(1) => # -- http://bugs.ruby-lang.org/