Class: Rational

Inherits:
Object show all
Defined in:
lib/ruby/jruby_hack.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:



581
582
583
# File 'lib/ruby/jruby_hack.rb', line 581

def to_d
  numerator.to_d / denominator.to_d
end