* complex.c (nucomp_to_i): allow complex with imaginary zero to be

converted.

* complex.c (nucomp_to_f, nucomp_to_r): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2010-07-22 23:48:13 +00:00
parent 1b1041f847
commit 95c6a8a3b7
2 changed files with 10 additions and 3 deletions

View File

@ -2,6 +2,13 @@ Thu Jul 22 20:58:55 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in (RUBY_EXTERN): unnecessary after all.
Thu Jul 22 17:33:47 2010 Yukihiro Matsumoto <matz@ruby-lang.org>
* complex.c (nucomp_to_i): allow complex with imaginary zero to be
converted.
* complex.c (nucomp_to_f, nucomp_to_r): ditto.
Thu Jul 22 20:12:56 2010 Yusuke Endoh <mame@tsg.ne.jp>
* thread_pthread.c (get_stack): fix memory leak; pthread_attr_destory

View File

@ -1295,7 +1295,7 @@ nucomp_to_i(VALUE self)
{
get_dat1(self);
if (k_inexact_p(dat->imag) || f_nonzero_p(dat->imag)) {
if (f_nonzero_p(dat->imag)) {
VALUE s = f_to_s(self);
rb_raise(rb_eRangeError, "can't convert %s into Integer",
StringValuePtr(s));
@ -1314,7 +1314,7 @@ nucomp_to_f(VALUE self)
{
get_dat1(self);
if (k_inexact_p(dat->imag) || f_nonzero_p(dat->imag)) {
if (f_nonzero_p(dat->imag)) {
VALUE s = f_to_s(self);
rb_raise(rb_eRangeError, "can't convert %s into Float",
StringValuePtr(s));
@ -1333,7 +1333,7 @@ nucomp_to_r(VALUE self)
{
get_dat1(self);
if (k_inexact_p(dat->imag) || f_nonzero_p(dat->imag)) {
if (f_nonzero_p(dat->imag)) {
VALUE s = f_to_s(self);
rb_raise(rb_eRangeError, "can't convert %s into Rational",
StringValuePtr(s));