opal/corelib/complex.rb in opal-0.10.6 vs opal/corelib/complex.rb in opal-0.11.0.rc1
- old
+ new
@@ -188,10 +188,12 @@
"(#{to_s})"
end
alias magnitude abs
+ undef negative?
+
def numerator
d = denominator
Complex(@real.numerator * (d / @real.denominator),
@imag.numerator * (d / @imag.denominator))
@@ -201,10 +203,12 @@
def polar
[abs, arg]
end
+ undef positive?
+
alias quo /
def rationalize(eps = undefined)
%x{
if (arguments.length > 1) {
@@ -254,10 +258,10 @@
end
def to_s
result = @real.inspect
- if (Number === @imag && @imag.nan?) || @imag.positive?
+ if (Number === @imag && @imag.nan?) || @imag.positive? || @imag.zero?
result += ?+
else
result += ?-
end