aboutsummaryrefslogtreecommitdiffstats
path: root/complex.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-08 17:53:51 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-08 17:53:51 +0000
commit71d114297f6891937ec680c4fa0e2455e12af4f4 (patch)
treebd22382fad5436a5e19fcfec2df56d3987e3855d /complex.c
parentfdc3882820d425b85082d5b871060aea39e6be81 (diff)
downloadruby-71d114297f6891937ec680c4fa0e2455e12af4f4.tar.gz
* complex.c (nucomp_expt): the result of f_complex_new2 may be a fixnum
with mathn. [ruby-core:44170] [Bug #6267] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'complex.c')
-rw-r--r--complex.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/complex.c b/complex.c
index c127a2681b..930c4453ec 100644
--- a/complex.c
+++ b/complex.c
@@ -887,7 +887,7 @@ nucomp_expt(VALUE self, VALUE other)
if (r)
break;
- x = f_complex_new2(CLASS_OF(self),
+ x = nucomp_s_new_internal(CLASS_OF(self),
f_sub(f_mul(dat->real, dat->real),
f_mul(dat->imag, dat->imag)),
f_mul(f_mul(TWO, dat->real), dat->imag));
@@ -896,7 +896,10 @@ nucomp_expt(VALUE self, VALUE other)
z = f_mul(z, x);
n--;
}
- return z;
+ {
+ get_dat1(z);
+ return f_complex_new2(CLASS_OF(self), dat->real, dat->imag);
+ }
}
return f_expt(f_reciprocal(self), f_negate(other));
}