Class: Rational
Instance Method Summary collapse
-
#to_d(precision) ⇒ Object
call-seq: rat.to_d(precision) -> bigdecimal.
Methods inherited from Numeric
Instance Method Details
#to_d(precision) ⇒ Object
call-seq: rat.to_d(precision) -> bigdecimal
Returns the value as a BigDecimal.
The required +precision+ parameter is used to determine the number of significant digits for the result.
require 'bigdecimal'
require 'bigdecimal/util'
Rational(22, 7).to_d(3) # => 0.314e1
See also BigDecimal::new.
128 129 130 |
# File 'opal/stdlib/bigdecimal/util.rb', line 128 def to_d(precision) BigDecimal(self, precision) end |