[前][次][番号順一覧][スレッド一覧]

ruby-changes:20259

From: naruse <ko1@a...>
Date: Thu, 30 Jun 2011 06:25:27 +0900 (JST)
Subject: [ruby-changes:20259] naruse:r32307 (trunk): * lib/cmath.rb (CMath.log): second argument: b can be nil.

naruse	2011-06-30 06:25:03 +0900 (Thu, 30 Jun 2011)

  New Revision: 32307

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32307

  Log:
    * lib/cmath.rb (CMath.log): second argument: b can be nil.

  Modified files:
    trunk/ChangeLog
    trunk/lib/cmath.rb
    trunk/test/test_cmath.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 32306)
+++ ChangeLog	(revision 32307)
@@ -1,3 +1,7 @@
+Thu Jun 30 06:17:02 2011  NARUSE, Yui  <naruse@r...>
+
+	* lib/cmath.rb (CMath.log): second argument: b can be nil.
+
 Thu Jun 30 06:23:28 2011  Eric Hodel  <drbrain@s...>
 
 	* thread.c (ruby_thread_s_pass):  Fix typo.
Index: lib/cmath.rb
===================================================================
--- lib/cmath.rb	(revision 32306)
+++ lib/cmath.rb	(revision 32307)
@@ -71,7 +71,7 @@
   def log(*args)
     begin
       z, b = args
-      unless b.kind_of?(Numeric)
+      unless b.nil? || b.kind_of?(Numeric)
 	raise TypeError,  "Numeric Number required"
       end
       if z.real? and z >= 0 and (b.nil? or b >= 0)
Index: test/test_cmath.rb
===================================================================
--- test/test_cmath.rb	(revision 32306)
+++ test/test_cmath.rb	(revision 32307)
@@ -6,6 +6,10 @@
     assert_equal CMath.sqrt(1.0.i), CMath.sqrt(1.i), '[ruby-core:31672]'
   end
 
+  def test_acos
+    assert_equal Complex(0.9368124611557199,-2.305509031243477), CMath.acos(Complex(3, 4))
+  end
+
   def test_cbrt_returns_principal_value_of_cube_root
     assert_equal CMath.cbrt(-8), (-8)**(1.0/3), '#3676'
   end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]