aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-29 21:25:03 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-29 21:25:03 +0000
commiteaa572e57d1a21892e57f7e451cb991fab32b2d2 (patch)
tree43107d351095da4a3bbb1afa67cf0169106db74b
parentbe9d096cc9f6b7ca277123ba351f84f10be3458e (diff)
downloadruby-eaa572e57d1a21892e57f7e451cb991fab32b2d2.tar.gz
* lib/cmath.rb (CMath.log): second argument: b can be nil.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--lib/cmath.rb2
-rw-r--r--test/test_cmath.rb4
3 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index cab245149d..1370e19a8a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Thu Jun 30 06:17:02 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/cmath.rb (CMath.log): second argument: b can be nil.
+
Thu Jun 30 06:23:28 2011 Eric Hodel <drbrain@segment7.net>
* thread.c (ruby_thread_s_pass): Fix typo.
diff --git a/lib/cmath.rb b/lib/cmath.rb
index 74ef41de72..eef1134ef3 100644
--- a/lib/cmath.rb
+++ b/lib/cmath.rb
@@ -71,7 +71,7 @@ module CMath
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)
diff --git a/test/test_cmath.rb b/test/test_cmath.rb
index 4f85ec3d04..ae4b15cafe 100644
--- a/test/test_cmath.rb
+++ b/test/test_cmath.rb
@@ -6,6 +6,10 @@ class TestCMath < Test::Unit::TestCase
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