From 537d0cab1dadb52c738d9e688147bb66c88d9164 Mon Sep 17 00:00:00 2001 From: mame Date: Thu, 22 Jul 2010 12:31:27 +0000 Subject: [PATCH] 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 --- ChangeLog | 5 +++++ lib/cmath.rb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b1cfa903cc..7803c5edcf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Jul 21 12:39:15 2010 Yusuke Endoh + + * lib/cmath.rb (CMath#cbrt): cbrt should accept a negative real + numbers. [ruby-core:31234] + Thu Jul 15 21:43:35 2010 Yusuke Endoh * numeric.c (fix_divide): must not use rb_rational_new1 for coercion diff --git a/lib/cmath.rb b/lib/cmath.rb index b23dac239c..976f269299 100644 --- a/lib/cmath.rb +++ b/lib/cmath.rb @@ -85,7 +85,7 @@ module CMath end def cbrt(z) - if z.real? and z >= 0 + if z.real? cbrt!(z) else Complex(z) ** (1.0/3)