mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
do not pass -infinity.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
50c1da22df
commit
0d7f4ad828
2 changed files with 4 additions and 5 deletions
|
@ -1,7 +1,6 @@
|
||||||
Thu Dec 11 23:48:00 2008 Tadayoshi Funaba <tadf@dotrb.org>
|
Thu Dec 11 23:48:00 2008 Tadayoshi Funaba <tadf@dotrb.org>
|
||||||
|
|
||||||
* lib/cmath.rb (sqrt): should pass nan or infinity to the original
|
* lib/cmath.rb (sqrt): should pass nan to the original method.
|
||||||
method.
|
|
||||||
|
|
||||||
Thu Dec 11 21:04:04 2008 Kouhei Sutou <kou@cozmixng.org>
|
Thu Dec 11 21:04:04 2008 Kouhei Sutou <kou@cozmixng.org>
|
||||||
|
|
||||||
|
|
|
@ -57,10 +57,10 @@ module CMath
|
||||||
|
|
||||||
def sqrt(z)
|
def sqrt(z)
|
||||||
if z.real?
|
if z.real?
|
||||||
if z >= 0 || (Float === z && (z.nan? || z.infinite?))
|
if z < 0
|
||||||
sqrt!(z)
|
|
||||||
else
|
|
||||||
Complex(0, sqrt!(-z))
|
Complex(0, sqrt!(-z))
|
||||||
|
else
|
||||||
|
sqrt!(z)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if z.imag < 0
|
if z.imag < 0
|
||||||
|
|
Loading…
Add table
Reference in a new issue