Class: Float (Ruby 2.7.2)
Description: Class : Float - 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.

# Float

### Public Instance Methods

to_d → bigdecimal click to toggle source
to_d(precision) → bigdecimal

Returns the value of `float` as a BigDecimal. The `precision` parameter is used to determine the number of significant digits for the result (the default is Float::DIG).

    require 'bigdecimal'
    require 'bigdecimal/util'

    0.5.to_d         # => 0.5e0
    1.234.to_d(2)    # => 0.12e1

See also BigDecimal::new.

                   # File bigdecimal/lib/bigdecimal/util.rb, line 46
    def to_d(precision=Float::DIG)
      BigDecimal(self, precision)
    end