diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-03-24 11:06:14 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-03-24 11:06:14 +0900 |
| commit | 9ed212ef9eedb09c5368a338ff905e25cdba149f (patch) | |
| tree | bbbb2cb4da9931ce252063096c3a89ed58022c6e /mrbgems/mruby-complex/mrblib/complex.rb | |
| parent | fa3ac351ff86efe517180afa6159679887656ced (diff) | |
| download | mruby-9ed212ef9eedb09c5368a338ff905e25cdba149f.tar.gz mruby-9ed212ef9eedb09c5368a338ff905e25cdba149f.zip | |
complex.c: implement `Complex` addition and subtraction in C.
Diffstat (limited to 'mrbgems/mruby-complex/mrblib/complex.rb')
| -rw-r--r-- | mrbgems/mruby-complex/mrblib/complex.rb | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/mrbgems/mruby-complex/mrblib/complex.rb b/mrbgems/mruby-complex/mrblib/complex.rb index 105c56d40..cd000a6c6 100644 --- a/mrbgems/mruby-complex/mrblib/complex.rb +++ b/mrbgems/mruby-complex/mrblib/complex.rb @@ -19,22 +19,6 @@ class Complex < Numeric Complex(-real, -imaginary) end - def +(rhs) - if rhs.is_a? Complex - Complex(real + rhs.real, imaginary + rhs.imaginary) - elsif rhs.is_a? Numeric - Complex(real + rhs, imaginary) - end - end - - def -(rhs) - if rhs.is_a? Complex - Complex(real - rhs.real, imaginary - rhs.imaginary) - elsif rhs.is_a? Numeric - Complex(real - rhs, imaginary) - end - end - def abs Math.hypot imaginary, real end |
