diff --git a/mrbgems/mruby-complex/mrblib/complex.rb b/mrbgems/mruby-complex/mrblib/complex.rb index e341efc5d..44b218024 100644 --- a/mrbgems/mruby-complex/mrblib/complex.rb +++ b/mrbgems/mruby-complex/mrblib/complex.rb @@ -19,6 +19,13 @@ class Complex < Numeric Complex(-real, -imaginary) end + def <=>(other) + return nil unless other.kind_of?(Numeric) + self.to_f <=> other.to_f + rescue + nil + end + def abs Math.hypot imaginary, real end