In Files

  • complex.rb

Parent

Methods

Class/Module Index [+]

Quicksearch

Object

Public Instance Methods

Complex(a, b = 0) click to toggle source

Creates a Complex number. a and b should be Numeric. The result will be a+bi.

 
               # File complex.rb, line 92
def Complex(a, b = 0)
  if b == 0 and (a.kind_of?(Complex) or defined? Complex::Unify)
    a
  else
    Complex.new( a.real-b.imag, a.imag+b.real )
  end
end