lib/hpsqrt.rb in hpsqrt-1.3.0 vs lib/hpsqrt.rb in hpsqrt-1.4.0
- old
+ new
@@ -115,9 +115,23 @@
else
super.==(other)
end
end
+ def rect
+ to_c.rect
+ end
+
+ def polar
+ to_c.polar
+ end
+
+ def arg
+ to_c.arg
+ end
+ alias_method :angle, :arg
+ alias_method :phase, :arg
+
def to_c
@terms.map {|t, c|
t.number * Math.sqrt(Complex(t.sqrt)) * c
}.sum.to_c
end