summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-08-16 23:12:41 +0000
committertadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-08-16 23:12:41 +0000
commite949fd9ca9f8783b41f9564b6b37b7f4b2578236 (patch)
treea788441119b881dad82a75c91ffead1e67968886
parente9268149834f0d371d44bc8a612cd6ba51c00e3d (diff)
downloadruby-e949fd9ca9f8783b41f9564b6b37b7f4b2578236.tar.gz
ruby-e949fd9ca9f8783b41f9564b6b37b7f4b2578236.tar.xz
ruby-e949fd9ca9f8783b41f9564b6b37b7f4b2578236.zip
use num#i.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--lib/cmath.rb8
2 files changed, 8 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index ae7b37df4..cb186490c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Mon Aug 17 08:11:53 2009 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/cmath.rb: use num#i.
+
Mon Aug 17 07:59:00 2009 Tadayoshi Funaba <tadf@dotrb.org>
* numeric.c (flo_pow,fix_pow): may return complex number.
diff --git a/lib/cmath.rb b/lib/cmath.rb
index c4b14e3ef..b23dac239 100644
--- a/lib/cmath.rb
+++ b/lib/cmath.rb
@@ -148,7 +148,7 @@ module CMath
if z.real? and z >= -1 and z <= 1
asin!(z)
else
- Complex(0, -1.0) * log(Complex(0, 1.0) * z + sqrt(1.0 - z * z))
+ (-1.0).i * log(1.0.i * z + sqrt(1.0 - z * z))
end
end
@@ -156,7 +156,7 @@ module CMath
if z.real? and z >= -1 and z <= 1
acos!(z)
else
- Complex(0, -1.0) * log(z + Complex(0, 1.0) * sqrt(1.0 - z * z))
+ (-1.0).i * log(z + 1.0.i * sqrt(1.0 - z * z))
end
end
@@ -164,7 +164,7 @@ module CMath
if z.real?
atan!(z)
else
- Complex(0, 1.0) * log((Complex(0, 1.0) + z) / (Complex(0, 1.0) - z)) / 2.0
+ 1.0.i * log((1.0.i + z) / (1.0.i - z)) / 2.0
end
end
@@ -172,7 +172,7 @@ module CMath
if y.real? and x.real?
atan2!(y,x)
else
- Complex(0, -1.0) * log((x + Complex(0, 1.0) * y) / sqrt(x * x + y * y))
+ (-1.0).i * log((x + 1.0.i * y) / sqrt(x * x + y * y))
end
end