From 470717b75e13f5e2c9d3cf87383fa1494d670f60 Mon Sep 17 00:00:00 2001 From: yugui Date: Sat, 13 Dec 2008 01:03:25 +0000 Subject: 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: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@20703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/cmath.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/cmath.rb b/lib/cmath.rb index 00bcc9087..95a30c336 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 -- cgit