%a{annotate:rdoc:skip} class Integer # # Returns the value of `int` as a BigDecimal. # # require 'bigdecimal' # require 'bigdecimal/util' # # 42.to_d # => 0.42e2 # # See also Kernel.BigDecimal. # def to_d: () -> BigDecimal end %a{annotate:rdoc:skip} class Float # # Returns the value of `float` as a BigDecimal. The `precision` parameter is # used to determine the number of significant digits for the result. When # `precision` is set to `0`, the number of digits to represent the float being # converted is determined automatically. The default `precision` is `0`. # # require 'bigdecimal' # require 'bigdecimal/util' # # 0.5.to_d # => 0.5e0 # 1.234.to_d # => 0.1234e1 # 1.234.to_d(2) # => 0.12e1 # # See also Kernel.BigDecimal. # def to_d: (?Integer precision) -> BigDecimal end %a{annotate:rdoc:skip} class String # # 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 Kernel.BigDecimal. # def to_d: () -> BigDecimal end %a{annotate:rdoc:skip} class BigDecimal # # Converts a BigDecimal to a String of the form "nnnnnn.mmm". This method is # deprecated; use BigDecimal#to_s("F") instead. # # require 'bigdecimal/util' # # d = BigDecimal("3.14") # d.to_digits # => "3.14" # def to_digits: () -> String # # Returns self. # # require 'bigdecimal/util' # # d = BigDecimal("3.14") # d.to_d # => 0.314e1 # def to_d: () -> BigDecimal end %a{annotate:rdoc:skip} class Rational # # Returns the value as a BigDecimal. # # The `precision` parameter is used to determine the number of significant # digits for the result. When `precision` is set to `0`, the number of digits to # represent the float being converted is determined automatically. The default # `precision` is `0`. # # require 'bigdecimal' # require 'bigdecimal/util' # # Rational(22, 7).to_d(3) # => 0.314e1 # # See also Kernel.BigDecimal. # def to_d: (Integer precision) -> BigDecimal end %a{annotate:rdoc:skip} class Complex # # Returns the value as a BigDecimal. If the imaginary part is not `0`, an error # is raised # # The `precision` parameter is used to determine the number of significant # digits for the result. When `precision` is set to `0`, the number of digits to # represent the float being converted is determined automatically. The default # `precision` is `0`. # # require 'bigdecimal' # require 'bigdecimal/util' # # Complex(0.1234567, 0).to_d(4) # => 0.1235e0 # Complex(Rational(22, 7), 0).to_d(3) # => 0.314e1 # Complex(1, 1).to_d # raises ArgumentError # # See also Kernel.BigDecimal. # def to_d: (*untyped args) -> BigDecimal end %a{annotate:rdoc:skip} class NilClass # # Returns nil represented as a BigDecimal. # # require 'bigdecimal' # require 'bigdecimal/util' # # nil.to_d # => 0.0 # def to_d: () -> BigDecimal end