Skip to content

Commit

Permalink
Merge pull request #274 from koic/tweak_docs_for_bigdecimal_util
Browse files Browse the repository at this point in the history
Update doc for bigdecimal/util
  • Loading branch information
hsbt committed Nov 7, 2023
2 parents 54aa09f + dd52adf commit 29f2e3b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/bigdecimal/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Integer < Numeric
#
# 42.to_d # => 0.42e2
#
# See also BigDecimal::new.
# See also Kernel.BigDecimal.
#
def to_d
BigDecimal(self)
Expand All @@ -45,7 +45,7 @@ class Float < Numeric
# 1.234.to_d # => 0.1234e1
# 1.234.to_d(2) # => 0.12e1
#
# See also BigDecimal::new.
# See also Kernel.BigDecimal.
#
def to_d(precision=0)
BigDecimal(self, precision)
Expand All @@ -67,7 +67,7 @@ class String
# "123.45e1".to_d # => 0.12345e4
# "45.67 degrees".to_d # => 0.4567e2
#
# See also BigDecimal::new.
# See also Kernel.BigDecimal.
#
def to_d
BigDecimal.interpret_loosely(self)
Expand Down Expand Up @@ -127,7 +127,7 @@ class Rational < Numeric
#
# Rational(22, 7).to_d(3) # => 0.314e1
#
# See also BigDecimal::new.
# See also Kernel.BigDecimal.
#
def to_d(precision)
BigDecimal(self, precision)
Expand All @@ -152,7 +152,7 @@ class Complex < Numeric
# Complex(0.1234567, 0).to_d(4) # => 0.1235e0
# Complex(Rational(22, 7), 0).to_d(3) # => 0.314e1
#
# See also BigDecimal::new.
# See also Kernel.BigDecimal.
#
def to_d(*args)
BigDecimal(self) unless self.imag.zero? # to raise eerror
Expand Down

0 comments on commit 29f2e3b

Please sign in to comment.