summaryrefslogtreecommitdiff
path: root/test/ruby/test_complex.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-20 02:49:18 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-20 02:49:18 +0000
commitb4bbfe4bb91db310d903a149cfa5525295e4a70c (patch)
treef4238c1cbdc236dc5f5ee2d16661f0fa22449f7a /test/ruby/test_complex.rb
parentc561284bc258dee0d3410f102573d768f6365f88 (diff)
downloadruby-b4bbfe4bb91db310d903a149cfa5525295e4a70c.tar.gz
complex.c: small optimization of Complex#**
* complex.c (rb_complex_pow): calculate power of a Fixnum without allocating intermediate Complex objects, and avoid unexpected NaNs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_complex.rb')
-rw-r--r--test/ruby/test_complex.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_complex.rb b/test/ruby/test_complex.rb
index 10289226fe..1180e9acb0 100644
--- a/test/ruby/test_complex.rb
+++ b/test/ruby/test_complex.rb
@@ -407,6 +407,10 @@ class Complex_Test < Test::Unit::TestCase
r = c ** Rational(-2,3)
assert_in_delta(0.432, r.real, 0.001)
assert_in_delta(-0.393, r.imag, 0.001)
+
+ c = Complex(0.0, -888888888888888.0)**8888
+ assert_not_predicate(c.real, :nan?)
+ assert_not_predicate(c.imag, :nan?)
end
def test_cmp