From 079fb8d4c369cfc7d450d6e4d02b112596dcb5ee Mon Sep 17 00:00:00 2001 From: mrkn Date: Tue, 26 Jul 2011 15:48:25 +0000 Subject: * ext/bigdecimal/lib/bigdecimal/util.rb (Float#to_d): modified for specifying precision. fixes #5098. [ruby-dev:44210] * test/bigdecimal/test_bigdecimal_util.rb: add test for the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/bigdecimal/lib/bigdecimal/util.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ext/bigdecimal/lib') diff --git a/ext/bigdecimal/lib/bigdecimal/util.rb b/ext/bigdecimal/lib/bigdecimal/util.rb index 1ec39a30ee..1e4bbbb596 100644 --- a/ext/bigdecimal/lib/bigdecimal/util.rb +++ b/ext/bigdecimal/lib/bigdecimal/util.rb @@ -27,8 +27,8 @@ class Float < Numeric # 0.5.to_d # # => # # - def to_d - BigDecimal(self.to_s) + def to_d(precision=nil) + BigDecimal(self, precision || Float::DIG+1) end end -- cgit v1.2.3