* 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
This commit is contained in:
parent
fdc3882820
commit
71d114297f
@ -1,3 +1,8 @@
|
|||||||
|
Mon Apr 9 02:52:03 2012 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
|
* complex.c (nucomp_expt): the result of f_complex_new2 may be a fixnum
|
||||||
|
with mathn. [ruby-core:44170] [Bug #6267]
|
||||||
|
|
||||||
Sun Apr 8 22:46:01 2012 NARUSE, Yui <naruse@ruby-lang.org>
|
Sun Apr 8 22:46:01 2012 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* ext/json/generator/generator.c (generate_json_bignum):
|
* ext/json/generator/generator.c (generate_json_bignum):
|
||||||
|
@ -887,7 +887,7 @@ nucomp_expt(VALUE self, VALUE other)
|
|||||||
if (r)
|
if (r)
|
||||||
break;
|
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_sub(f_mul(dat->real, dat->real),
|
||||||
f_mul(dat->imag, dat->imag)),
|
f_mul(dat->imag, dat->imag)),
|
||||||
f_mul(f_mul(TWO, dat->real), 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);
|
z = f_mul(z, x);
|
||||||
n--;
|
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));
|
return f_expt(f_reciprocal(self), f_negate(other));
|
||||||
}
|
}
|
||||||
|
@ -6,5 +6,6 @@ class TestMathn < Test::Unit::TestCase
|
|||||||
def test_power
|
def test_power
|
||||||
assert_in_out_err ['-r', 'mathn', '-e', 'a=1**2;!a'], "", [], [], '[ruby-core:25740]'
|
assert_in_out_err ['-r', 'mathn', '-e', 'a=1**2;!a'], "", [], [], '[ruby-core:25740]'
|
||||||
assert_in_out_err ['-r', 'mathn', '-e', 'a=(1<<126)**2;!a'], "", [], [], '[ruby-core:25740]'
|
assert_in_out_err ['-r', 'mathn', '-e', 'a=(1<<126)**2;!a'], "", [], [], '[ruby-core:25740]'
|
||||||
|
assert_in_out_err ['-r', 'mathn/complex', '-e', 'a=Complex(0,1)**5;!a'], "", [], [], '[ruby-core:44170]'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user