Class: Rational

Inherits:
Object show all
Defined in:
lib/ruby/to_d.rb

Instance Method Summary collapse

Instance Method Details

#to_dBigDecimal

Converts the rational to a BigDecimal

Examples:

Rational(3, 4).to_d   #=> BigDecimal("3") / BigDecimal("4")

Returns:



58
59
60
# File 'lib/ruby/to_d.rb', line 58

def to_d
  numerator.to_d / denominator.to_d
end