* 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
This commit is contained in:
parent
be9d096cc9
commit
eaa572e57d
@ -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>
|
Thu Jun 30 06:23:28 2011 Eric Hodel <drbrain@segment7.net>
|
||||||
|
|
||||||
* thread.c (ruby_thread_s_pass): Fix typo.
|
* thread.c (ruby_thread_s_pass): Fix typo.
|
||||||
|
@ -71,7 +71,7 @@ module CMath
|
|||||||
def log(*args)
|
def log(*args)
|
||||||
begin
|
begin
|
||||||
z, b = args
|
z, b = args
|
||||||
unless b.kind_of?(Numeric)
|
unless b.nil? || b.kind_of?(Numeric)
|
||||||
raise TypeError, "Numeric Number required"
|
raise TypeError, "Numeric Number required"
|
||||||
end
|
end
|
||||||
if z.real? and z >= 0 and (b.nil? or b >= 0)
|
if z.real? and z >= 0 and (b.nil? or b >= 0)
|
||||||
|
@ -6,6 +6,10 @@ class TestCMath < Test::Unit::TestCase
|
|||||||
assert_equal CMath.sqrt(1.0.i), CMath.sqrt(1.i), '[ruby-core:31672]'
|
assert_equal CMath.sqrt(1.0.i), CMath.sqrt(1.i), '[ruby-core:31672]'
|
||||||
end
|
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
|
def test_cbrt_returns_principal_value_of_cube_root
|
||||||
assert_equal CMath.cbrt(-8), (-8)**(1.0/3), '#3676'
|
assert_equal CMath.cbrt(-8), (-8)**(1.0/3), '#3676'
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user