summaryrefslogtreecommitdiff
path: root/lib/complex.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/complex.rb')
-rw-r--r--lib/complex.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/complex.rb b/lib/complex.rb
index 0e88dd5f4f..1845f30b1f 100644
--- a/lib/complex.rb
+++ b/lib/complex.rb
@@ -2,3 +2,9 @@ require 'cmath'
Object.instance_eval{remove_const :Math}
Math = CMath
+
+def Complex.generic? (other)
+ other.kind_of?(Integer) ||
+ other.kind_of?(Float) ||
+ other.kind_of?(Rational)
+end