diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | lib/cmath.rb | 3 |
2 files changed, 6 insertions, 1 deletions
@@ -1,3 +1,7 @@ +Sun Jun 28 21:16:48 2009 Tadayoshi Funaba <tadf@dotrb.org> + + * lib/cmath.rb (sqrt): fixed an issue [ruby-list:45852]. + Sun Jun 28 19:48:29 2009 Tadayoshi Funaba <tadf@dotrb.org> * complex.c (nucomp_expt): some improvements. diff --git a/lib/cmath.rb b/lib/cmath.rb index d9e53f361..6b47e70a1 100644 --- a/lib/cmath.rb +++ b/lib/cmath.rb @@ -63,7 +63,8 @@ module CMath sqrt!(z) end else - if z.imag < 0 + if z.imag < 0 || + (z.imag == 0 && z.imag.to_s[0] == '-') sqrt(z.conjugate).conjugate else r = z.abs |