Category talk:Wren-complex: Difference between revisions
Content added Content deleted
(→Source code: Negative zero woes :() |
(→Source code: Broadened the scope of the division and equality operators.) |
||
Line 190: | Line 190: | ||
} |
} |
||
/(o) { |
/(o) { |
||
o = Complex.check_(o) |
|||
var i = o.inverse |
|||
return Complex.new_( |
|||
_real * i.real - _imag * i.imag, |
|||
_real * i.imag + _imag * i.real |
|||
) |
|||
} |
|||
// Returns the absolute value or modulus of this instance. |
// Returns the absolute value or modulus of this instance. |
||
Line 301: | Line 308: | ||
// Equality operators. |
// Equality operators. |
||
==(o) { |
==(o) { |
||
o = Complex.check_(o) |
|||
return _real == o.real && _imag == o.imag |
|||
} |
|||
!=(o) { !(this == o) } |
!=(o) { !(this == o) } |
||