summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-13 01:03:25 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-13 01:03:25 +0000
commit2adcc421f386ac8f8d59858a02422ffcaf0b1f49 (patch)
tree5a1b9fb13a9b8d5547f1b11ce853220344b726c6
parent8f8000beee6847392e32be94389195cf3618cf9c (diff)
merges r20646 and r20647 from trunk into ruby_1_9_1.
* lib/cmath.rb (sqrt): should pass nan or infinity to the original method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@20703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--lib/cmath.rb6
2 files changed, 7 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 13696cd483..5e208739a3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Thu Dec 11 23:48:00 2008 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/cmath.rb (sqrt): should pass nan to the original method.
+
Thu Dec 11 19:31:45 2008 Tanaka Akira <akr@fsij.org>
* lib/test/unit/assertions.rb: extracted from lib/test/unit.rb.
diff --git a/lib/cmath.rb b/lib/cmath.rb
index 00bcc9087f..95a30c336b 100644
--- a/lib/cmath.rb
+++ b/lib/cmath.rb
@@ -57,10 +57,10 @@ module CMath
def sqrt(z)
if z.real?
- if z >= 0
- sqrt!(z)
- else
+ if z < 0
Complex(0, sqrt!(-z))
+ else
+ sqrt!(z)
end
else
if z.imag < 0