summaryrefslogtreecommitdiff
path: root/complex.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-27 01:01:26 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-27 01:01:26 +0000
commitea5e91b51fd7b2957fd4febc57be1d61f6ca318f (patch)
tree62336ed85306deef4ce94a1f89c3476672bb4e5a /complex.c
parentb9031d70887890b123559d203a82d04b83fa53e5 (diff)
* 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
Diffstat (limited to 'complex.c')
-rw-r--r--complex.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/complex.c b/complex.c
index 3965f3dd2d..10ab4a4563 100644
--- a/complex.c
+++ b/complex.c
@@ -1342,7 +1342,7 @@ rb_complex_finite_p(VALUE self)
/*
* call-seq:
- * cmp.infinite? -> nil or 1 or -1
+ * cmp.infinite? -> nil or 1
*
* 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)) {
const double f = RFLOAT_VALUE(magnitude);
if (isinf(f)) {
- return INT2FIX(f < 0 ? -1 : 1);
+ return ONE;
}
return Qnil;
}