lib/bigdecimal/util.rb in bigdecimal-1.3.0.pre.2 vs lib/bigdecimal/util.rb in bigdecimal-1.3.0
- old
+ new
@@ -11,11 +11,11 @@
#
# require 'bigdecimal'
# require 'bigdecimal/util'
#
# 42.to_d
- # # => #<BigDecimal:1008ef070,'0.42E2',9(36)>
+ # # => 0.42e2
#
def to_d
BigDecimal(self)
end
end
@@ -32,11 +32,11 @@
#
# require 'bigdecimal'
# require 'bigdecimal/util'
#
# 0.5.to_d
- # # => #<BigDecimal:1dc69e0,'0.5E0',9(18)>
+ # # => 0.5e0
#
def to_d(precision=nil)
BigDecimal(self, precision || Float::DIG)
end
end
@@ -53,11 +53,11 @@
#
# require 'bigdecimal'
# require 'bigdecimal/util'
#
# "0.5".to_d
- # # => #<BigDecimal:1dc69e0,'0.5E0',9(18)>
+ # # => 0.5e0
#
def to_d
BigDecimal(self)
end
end
@@ -115,10 +115,10 @@
# parameters.
#
# r = (22/7.0).to_r
# # => (7077085128725065/2251799813685248)
# r.to_d(3)
- # # => #<BigDecimal:1a44d08,'0.314E1',18(36)>
+ # # => 0.314e1
def to_d(precision)
if precision <= 0
raise ArgumentError, "negative precision"
end
num = self.numerator