End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
String#to_d
str.to_d → bigdecimal
ext/bigdecimal/lib/bigdecimal/util.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.0.5/ext/bigdecimal/lib/bigdecimal/util.rb, line 68
def to_d
BigDecimal.interpret_loosely(self)
end
Returns the result of interpreting leading characters in str as a BigDecimal.
Example
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.