From e6bea8978c9ec6b69a546f68416dd87dacac8b2a Mon Sep 17 00:00:00 2001 From: mrkn Date: Mon, 13 Jun 2011 05:36:59 +0000 Subject: * lib/cmath.rb (CMath.cbrt): returns the principal value of the cube root of the argument. fix #3676 * test/test_cmath.rb (test_cbrt_returns_principal_value_of_cube_root): test for the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/cmath.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'lib/cmath.rb') diff --git a/lib/cmath.rb b/lib/cmath.rb index 24a0e70f9c..4751f6c4a1 100644 --- a/lib/cmath.rb +++ b/lib/cmath.rb @@ -122,13 +122,9 @@ module CMath end ## - # returns the cube root of +z+ + # returns the principal value of the cube root of +z+ def cbrt(z) - if z.real? - cbrt!(z) - else - Complex(z) ** (1.0/3) - end + Complex(z) ** (1.0/3) end ## -- cgit v1.2.3