method

to_d

Importance_1
to_d(precision) public

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.

Show source
Register or log in to add new notes.