aboutsummaryrefslogtreecommitdiffstats
path: root/lib/cmath.rb
diff options
context:
space:
mode:
authormrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-11 14:30:47 +0000
committermrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-11 14:30:47 +0000
commit9b0b9ac237c60d34c9cd06538d1a133eed9f7130 (patch)
tree2fa02528f508bc40c50d86e221b40f215650dae6 /lib/cmath.rb
parentc89bdea7c9ea3776e1a8994590dffd847c61f1df (diff)
downloadruby-9b0b9ac237c60d34c9cd06538d1a133eed9f7130.tar.gz
* lib/cmath.rb (CMath.sqrt): use floating-point value. [ruby-core:31672] [Bug #3678]
* test/test_cmath.rb: added for testing lib/cmath.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/cmath.rb')
-rw-r--r--lib/cmath.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/cmath.rb b/lib/cmath.rb
index 976f269299..3c94221f2c 100644
--- a/lib/cmath.rb
+++ b/lib/cmath.rb
@@ -79,7 +79,7 @@ module CMath
else
r = z.abs
x = z.real
- Complex(sqrt!((r + x) / 2), sqrt!((r - x) / 2))
+ Complex(sqrt!((r + x) / 2.0), sqrt!((r - x) / 2.0))
end
end
end