mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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/trunk@28698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
770af8649a
commit
c618db17ee
2 changed files with 7 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue