Class: Rational (Ruby 2.7.2)
Description: Class : Rational - Ruby 2.7.2

### Home Classes Methods

### In Files

- bigdecimal/lib/bigdecimal/util.rb

### Parent

Numeric

### Methods

- #to_d

### Class/Module Index

Quicksearch

- BigDecimal
- BigMath
- Float
- Integer
- Jacobian
- Kernel
- LUSolve
- Newton
- NilClass
- Rational
- String

No matching classes.

# Rational

### Public Instance Methods

to_d(precision) → bigdecimal click to toggle source

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.

                   # File bigdecimal/lib/bigdecimal/util.rb, line 128
    def to_d(precision)
      BigDecimal(self, precision)
    end