merges r28698 from trunk into ruby_1_9_2.

--
* lib/cmath.rb (CMath#cbrt): cbrt should accept a negative real
  numbers.  [ruby-core:31234]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@28718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mame 2010-07-22 12:31:27 +00:00
parent 835dcc220e
commit 537d0cab1d
2 changed files with 6 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Wed Jul 21 12:39:15 2010 Yusuke Endoh <mame@tsg.ne.jp>
* lib/cmath.rb (CMath#cbrt): cbrt should accept a negative real
numbers. [ruby-core:31234]
Thu Jul 15 21:43:35 2010 Yusuke Endoh <mame@tsg.ne.jp> Thu Jul 15 21:43:35 2010 Yusuke Endoh <mame@tsg.ne.jp>
* numeric.c (fix_divide): must not use rb_rational_new1 for coercion * numeric.c (fix_divide): must not use rb_rational_new1 for coercion

View file

@ -85,7 +85,7 @@ module CMath
end end
def cbrt(z) def cbrt(z)
if z.real? and z >= 0 if z.real?
cbrt!(z) cbrt!(z)
else else
Complex(z) ** (1.0/3) Complex(z) ** (1.0/3)