summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-01 12:22:06 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-01 12:22:06 +0000
commitb22c83311d62dbb74677418c010f20c12e64faf2 (patch)
tree851cd64e2a5623da54f5748bd21e21cab30df6da /numeric.c
parentff60853e4cb6513e6c7afc7804b9cb54927215d6 (diff)
revert r28788 (backport of r28751).
The patch seems to be revised by r28763. The patch will be backported after it is stabilized by an experience in trunk. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@28824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/numeric.c b/numeric.c
index d291a6dd85..fdea3ce50c 100644
--- a/numeric.c
+++ b/numeric.c
@@ -1016,7 +1016,7 @@ rb_dbl_cmp(double a, double b)
static VALUE
flo_cmp(VALUE x, VALUE y)
{
- double a, b, i;
+ double a, b;
a = RFLOAT_VALUE(x);
if (isnan(a)) return Qnil;
@@ -1038,12 +1038,8 @@ flo_cmp(VALUE x, VALUE y)
break;
default:
- if (isinf(a) && (i = rb_check_funcall(y, rb_intern("infinite?"), 0, 0)) != Qundef) {
- if (RTEST(i)) {
- int j = rb_cmpint(i, x, y);
- j = (a > 0.0) ? (j > 0 ? 0 : +1) : (j < 0 ? 0 : -1);
- return INT2FIX(j);
- }
+ if (isinf(a) && (!rb_respond_to(y, rb_intern("infinite?")) ||
+ !RTEST(rb_funcall(y, rb_intern("infinite?"), 0, 0)))) {
if (a > 0.0) return INT2FIX(1);
return INT2FIX(-1);
}