mirror of
https://github.com/ruby/ruby.git
synced 2025-08-27 15:06:10 +02:00
Integer#pow(b)
accepts numeric
instead of integer only and returns numeric instead of integer only same as `Integer#**` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
956cfb974f
commit
49dc866492
2 changed files with 5 additions and 1 deletions
|
@ -386,6 +386,10 @@ class TestNumeric < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_pow
|
||||
assert_equal(2**3, 2.pow(3))
|
||||
assert_equal(2**-1, 2.pow(-1))
|
||||
assert_equal(2**0.5, 2.pow(0.5))
|
||||
assert_equal((-1)**0.5, -1.pow(0.5))
|
||||
assert_equal(3**3 % 8, 3.pow(3, 8))
|
||||
assert_equal(3**3 % -8, 3.pow(3,-8))
|
||||
assert_equal(3**2 % -2, 3.pow(2,-2))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue