diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-21 05:55:08 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-21 05:55:08 +0000 |
commit | 2cd83035a867cec68323d32c975fccf311675055 (patch) | |
tree | 28cd0324f43423c2d5fea939cb307ac69acb0d99 /ext | |
parent | ef61d714f3d1ef8652935fc95776e7e0f93fdb07 (diff) |
merge revision(s) 43669,43672,43678: [Backport #8958]
* ext/bigdecimal/lib/bigdecimal/util.rb: [DOC] Document the required
+precision+ argument for Rational#to_d [Bug #8958]
* ext/bigdecimal/lib/bigdecimal/util.rb: [DOC] +precision+ is required
* ext/bigdecimal/lib/bigdecimal/util.rb: [DOC] remove example of
Rational#to_d without argument. [Bug #8958]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@44314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/bigdecimal/lib/bigdecimal/util.rb | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/ext/bigdecimal/lib/bigdecimal/util.rb b/ext/bigdecimal/lib/bigdecimal/util.rb index b27e64c511..4c8fc07b7d 100644 --- a/ext/bigdecimal/lib/bigdecimal/util.rb +++ b/ext/bigdecimal/lib/bigdecimal/util.rb @@ -83,16 +83,17 @@ end class Rational < Numeric # call-seq: - # r.to_d -> bigdecimal - # r.to_d(sig) -> bigdecimal + # r.to_d(precision) -> bigdecimal # - # Converts a Rational to a BigDecimal. Takes an optional parameter +sig+ to - # limit the amount of significant digits. + # Converts a Rational to a BigDecimal. + # + # The required +precision+ parameter is used to determine the amount of + # significant digits for the result. See BigDecimal#div for more information, + # as it is used along with the #denominator and the +precision+ for + # parameters. # # r = (22/7.0).to_r # # => (7077085128725065/2251799813685248) - # r.to_d - # # => #<BigDecimal:1a52bd8,'0.3142857142 8571427937 0154144999 105E1',45(63)> # r.to_d(3) # # => #<BigDecimal:1a44d08,'0.314E1',18(36)> def to_d(precision) |