mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/cmath.rb (sqrt): should pass nan or infinity to the original
method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
876e1b87e7
commit
50c1da22df
2 changed files with 6 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Thu Dec 11 23:48:00 2008 Tadayoshi Funaba <tadf@dotrb.org>
|
||||||
|
|
||||||
|
* lib/cmath.rb (sqrt): should pass nan or infinity to the original
|
||||||
|
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>
|
||||||
|
|
||||||
* lib/rss/maker.rb, lib/rss/maker/0.9.rb, lib/rss/maker/base.rb:
|
* lib/rss/maker.rb, lib/rss/maker/0.9.rb, lib/rss/maker/base.rb:
|
||||||
|
|
|
@ -57,7 +57,7 @@ module CMath
|
||||||
|
|
||||||
def sqrt(z)
|
def sqrt(z)
|
||||||
if z.real?
|
if z.real?
|
||||||
if z >= 0
|
if z >= 0 || (Float === z && (z.nan? || z.infinite?))
|
||||||
sqrt!(z)
|
sqrt!(z)
|
||||||
else
|
else
|
||||||
Complex(0, sqrt!(-z))
|
Complex(0, sqrt!(-z))
|
||||||
|
|
Loading…
Reference in a new issue