summaryrefslogtreecommitdiff
path: root/ext/bigdecimal/lib/bigdecimal/util.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bigdecimal/lib/bigdecimal/util.rb')
-rw-r--r--ext/bigdecimal/lib/bigdecimal/util.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/bigdecimal/lib/bigdecimal/util.rb b/ext/bigdecimal/lib/bigdecimal/util.rb
index 1ec39a3..1e4bbbb 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
# # => #<BigDecimal:1dc69e0,'0.5E0',9(18)>
#
- def to_d
- BigDecimal(self.to_s)
+ def to_d(precision=nil)
+ BigDecimal(self, precision || Float::DIG+1)
end
end