Issue #8958 has been updated by zzak (Zachary Scott).

Status changed from Open to Assigned

It seems the documentation is wrong, the implementation is a required argument: https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/lib/bigdecimal/util.rb#L119

I have asked for feedback from murata-san to confirm this spec in BigDecimal.

Thank you for finding this bug!
----------------------------------------
Bug #8958: Rational#to_d don't match documentation
https://bugs.ruby-lang.org/issues/8958#change-42021

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 `<main>'
2.0.0p247 :004 > 3.to_r.to_d(1)
 => #<BigDecimal:7ffc8c8afaa8,'0.3E1',9(36)>






-- 
http://bugs.ruby-lang.org/