diff options
| -rw-r--r-- | ChangeLog | 4 | ||||
| -rw-r--r-- | lib/cmath.rb | 6 |
2 files changed, 7 insertions, 3 deletions
@@ -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 |
