class Complex

def to_d(*args)


See also Kernel.BigDecimal.

Complex(Rational(22, 7), 0).to_d(3) # => 0.314e1
Complex(0.1234567, 0).to_d(4) # => 0.1235e0

require 'bigdecimal/util'
require 'bigdecimal'

for the result.
This parameter is used to determine the number of significant digits
The +precision+ parameter is required for a rational complex number.

Returns the value as a BigDecimal.

cmp.to_d(precision) -> bigdecimal
cmp.to_d -> bigdecimal
call-seq:
def to_d(*args)
  BigDecimal(self) unless self.imag.zero? # to raise error
  if args.length == 0
    case self.real
    when Rational
      BigDecimal(self.real) # to raise error
    end
  end
  self.real.to_d(*args)
end