diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mathn.rb | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/lib/mathn.rb b/lib/mathn.rb index d6f2da0210..9cb9401e37 100644 --- a/lib/mathn.rb +++ b/lib/mathn.rb @@ -103,14 +103,7 @@ module Math def sqrt(a) if a.kind_of?(Complex) - abs = sqrt(a.real*a.real + a.imag*a.imag) - x = sqrt((a.real + abs)/Rational(2)) - y = sqrt((-a.real + abs)/Rational(2)) - if a.imag >= 0 - Complex(x, y) - else - Complex(x, -y) - end + sqrt!(a) elsif a.respond_to?(:nan?) and a.nan? a elsif a >= 0 |