summaryrefslogtreecommitdiff
path: root/lib/complex.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/complex.rb')
-rw-r--r--lib/complex.rb18
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/complex.rb b/lib/complex.rb
index 1845f30b1f..301879143f 100644
--- a/lib/complex.rb
+++ b/lib/complex.rb
@@ -1,10 +1,24 @@
require 'cmath'
-Object.instance_eval{remove_const :Math}
-Math = CMath
+unless defined?(Math.exp!)
+ Object.instance_eval{remove_const :Math}
+ Math = CMath
+end
def Complex.generic? (other)
other.kind_of?(Integer) ||
other.kind_of?(Float) ||
other.kind_of?(Rational)
end
+
+class Complex
+
+ alias image imag
+
+end
+
+class Numeric
+
+ def im() Complex(0, self) end
+
+end