Issue #3609 has been updated by Marc-Andre Lafortune.

Status changed from Closed to Open
Assigned to deleted (Yuki Sonoda)

The patch fixes comparison with non numerics, but doesn't address the rest of the issues:
- inconsistency with mathematics
- inconsistency with other operators like <, <=, ..

Is there objection to removing the special test for infinity?

diff --git a/numeric.c b/numeric.c
index 740ef54..ed159ce 100644
--- a/numeric.c
+++ b/numeric.c
@@ -1039,15 +1039,6 @@ 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 (a > 0.0) return INT2FIX(1);
-           return INT2FIX(-1);
-       }
        return rb_num_coerce_cmp(x, y, rb_intern("<=>"));
     }
     return rb_dbl_cmp(a, b);

----------------------------------------
http://redmine.ruby-lang.org/issues/show/3609

----------------------------------------
http://redmine.ruby-lang.org