In Files

  • bigdecimal/lib/bigdecimal/util.rb

Parent

Methods

Class/Module Index [+]

Quicksearch

Rational

Public Instance Methods

to_d(nFig=0) click to toggle source

Converts a Rational to a BigDecimal

 
               # File bigdecimal/lib/bigdecimal/util.rb, line 46
def to_d(nFig=0)
  num = self.numerator.to_s
  if nFig<=0
    nFig = BigDecimal.double_fig*2+1
  end
  BigDecimal.new(num).div(self.denominator,nFig)
end