[前][次][番号順一覧][スレッド一覧]

ruby-changes:16829

From: mame <ko1@a...>
Date: Sun, 1 Aug 2010 21:22:24 +0900 (JST)
Subject: [ruby-changes:16829] Ruby:r28824 (ruby_1_9_2): revert r28788 (backport of r28751).

mame	2010-08-01 21:22:06 +0900 (Sun, 01 Aug 2010)

  New Revision: 28824

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=28824

  Log:
    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.

  Modified files:
    branches/ruby_1_9_2/ChangeLog
    branches/ruby_1_9_2/numeric.c
    branches/ruby_1_9_2/test/ruby/test_float.rb

Index: ruby_1_9_2/ChangeLog
===================================================================
--- ruby_1_9_2/ChangeLog	(revision 28823)
+++ ruby_1_9_2/ChangeLog	(revision 28824)
@@ -19,11 +19,6 @@
 	* bignum.c (big_op): comparison of bignum and infinity has returned 1
 	  or -1, but it must return boolean.
 
-Sun Jul 25 05:37:20 2010  Nobuyoshi Nakada  <nobu@r...>
-
-	* numeric.c (flo_cmp): honor the result of infinite? method of the
-	  other.  [ruby-core:31470]
-
 Wed Jul 21 15:22:17 2010  Evan Phoenix <evan@f...>
 
 	* lib/rubygems/custom_require.rb, gem_prelude.rb: Load code from
Index: ruby_1_9_2/numeric.c
===================================================================
--- ruby_1_9_2/numeric.c	(revision 28823)
+++ ruby_1_9_2/numeric.c	(revision 28824)
@@ -1016,7 +1016,7 @@
 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 @@
 	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);
 	}
Index: ruby_1_9_2/test/ruby/test_float.rb
===================================================================
--- ruby_1_9_2/test/ruby/test_float.rb	(revision 28823)
+++ ruby_1_9_2/test/ruby/test_float.rb	(revision 28824)
@@ -239,20 +239,6 @@
     assert_equal(-1, (Float::MAX.to_i*2) <=> inf)
     assert_equal(1, (-Float::MAX.to_i*2) <=> -inf)
 
-    bug3609 = '[ruby-core:31470]'
-    def (pinf = Object.new).infinite?; +1 end
-    def (ninf = Object.new).infinite?; -1 end
-    def (fin = Object.new).infinite?; nil end
-    nonum = Object.new
-    assert_equal(0, inf <=> pinf, bug3609)
-    assert_equal(1, inf <=> fin, bug3609)
-    assert_equal(1, inf <=> ninf, bug3609)
-    assert_nil(inf <=> nonum, bug3609)
-    assert_equal(-1, -inf <=> pinf, bug3609)
-    assert_equal(-1, -inf <=> fin, bug3609)
-    assert_equal(0, -inf <=> ninf, bug3609)
-    assert_nil(-inf <=> nonum, bug3609)
-
     assert_raise(ArgumentError) { 1.0 > nil }
     assert_raise(ArgumentError) { 1.0 >= nil }
     assert_raise(ArgumentError) { 1.0 < nil }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]