* complex.c: fix Complex#infinite? return value. Because nucomp_abs never returns negative value.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2017-09-27 01:01:26 +00:00
parent b9031d7088
commit ea5e91b51f

View File

@ -1342,7 +1342,7 @@ rb_complex_finite_p(VALUE self)
/* /*
* call-seq: * call-seq:
* cmp.infinite? -> nil or 1 or -1 * cmp.infinite? -> nil or 1
* *
* Returns values corresponding to the value of +cmp+'s magnitude: * Returns values corresponding to the value of +cmp+'s magnitude:
* *
@ -1365,7 +1365,7 @@ rb_complex_infinite_p(VALUE self)
if (RB_FLOAT_TYPE_P(magnitude)) { if (RB_FLOAT_TYPE_P(magnitude)) {
const double f = RFLOAT_VALUE(magnitude); const double f = RFLOAT_VALUE(magnitude);
if (isinf(f)) { if (isinf(f)) {
return INT2FIX(f < 0 ? -1 : 1); return ONE;
} }
return Qnil; return Qnil;
} }