summaryrefslogtreecommitdiff
path: root/test/ruby/test_float.rb
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2020-05-12 02:12:06 +0900
committerYusuke Endoh <mame@ruby-lang.org>2020-05-12 02:14:27 +0900
commit42abad2464a78e3ec8a42f85c7bc878233f3ce16 (patch)
treec1aa0dbc813463918e39bf16395c815630ee4b75 /test/ruby/test_float.rb
parent95ac235537fc0e46e4c18f1e82cf14d0a98b3b92 (diff)
numeric.c: optimize `float ** 2` case by fastpath
It would be a relatively frequent case. It is still slower than `float * float` because `*` has a dedicated VM instruction (opt_mult), though.
Diffstat (limited to 'test/ruby/test_float.rb')
-rw-r--r--test/ruby/test_float.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/test/ruby/test_float.rb b/test/ruby/test_float.rb
index 0daa3cca57..fbf0d87f8e 100644
--- a/test/ruby/test_float.rb
+++ b/test/ruby/test_float.rb
@@ -305,6 +305,7 @@ class TestFloat < Test::Unit::TestCase
assert_equal(1.0, 1.0 ** (2**32))
assert_equal(1.0, 1.0 ** 1.0)
assert_raise(TypeError) { 1.0 ** nil }
+ assert_equal(9.0, 3.0 ** 2)
end
def test_eql