Class: String (Ruby 2.7.5)
Description: Class : String - Ruby 2.7.5

### Home Classes Methods

### In Files

- bigdecimal/lib/bigdecimal/util.rb

### Parent

Object

### Methods

- #to_d

### Class/Module Index

Quicksearch

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

No matching classes.

# String

### Public Instance Methods

to_d → bigdecimal click to toggle source

Returns the result of interpreting leading characters in `str` as a `BigDecimal`.

    require 'bigdecimal'
    require 'bigdecimal/util'

    "0.5".to_d             # => 0.5e0
    "123.45e1".to_d        # => 0.12345e4
    "45.67 degrees".to_d   # => 0.4567e2

See also BigDecimal::new.

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