[macruby-changes] [4579] MacRuby/trunk/lib/cmath.rb

source_changes at macosforge.org source_changes at macosforge.org
Tue Oct 5 00:49:41 PDT 2010


Revision: 4579
          http://trac.macosforge.org/projects/ruby/changeset/4579
Author:   watson1978 at gmail.com
Date:     2010-10-05 00:49:40 -0700 (Tue, 05 Oct 2010)
Log Message:
-----------
Fixed a bug of CMath.cbrt, when is passed a negative value to an argument.

{{{
$ ruby19 -v -r cmath -e 'p CMath.cbrt(-8)'
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]
-2.0

$ macruby -v -r cmath -e 'p CMath.cbrt(-8)'
MacRuby 0.8 (ruby 1.9.2) [universal-darwin10.0, x86_64]
(1.0+1.73205080756888i)
}}}

Revision Links:
--------------
    http://trac.macosforge.org/projects/ruby/changeset/29036

Modified Paths:
--------------
    MacRuby/trunk/lib/cmath.rb

Modified: MacRuby/trunk/lib/cmath.rb
===================================================================
--- MacRuby/trunk/lib/cmath.rb	2010-10-05 04:44:45 UTC (rev 4578)
+++ MacRuby/trunk/lib/cmath.rb	2010-10-05 07:49:40 UTC (rev 4579)
@@ -85,7 +85,7 @@
   end
 
   def cbrt(z)
-    if z.real? and z >= 0
+    if z.real?
       cbrt!(z)
     else
       Complex(z) ** (1.0/3)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101005/db3c24f4/attachment-0001.html>


More information about the macruby-changes mailing list