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

ruby-changes:12258

From: tadf <ko1@a...>
Date: Fri, 3 Jul 2009 21:31:43 +0900 (JST)
Subject: [ruby-changes:12258] Ruby:r23948 (trunk): * complex.c (nucomp_equal_p): removed.

tadf	2009-07-03 21:31:26 +0900 (Fri, 03 Jul 2009)

  New Revision: 23948

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

  Log:
    * complex.c (nucomp_equal_p): removed.

  Modified files:
    trunk/ChangeLog
    trunk/complex.c
    trunk/test/ruby/test_complex.rb

Index: complex.c
===================================================================
--- complex.c	(revision 23947)
+++ complex.c	(revision 23948)
@@ -18,9 +18,9 @@
 VALUE rb_cComplex;
 
 static ID id_abs, id_abs2, id_arg, id_cmp, id_conj, id_convert,
-    id_denominator, id_divmod, id_eqeq_p, id_equal_p, id_expt, id_fdiv,
-    id_floor, id_idiv, id_imag, id_inspect, id_negate, id_numerator,
-    id_quo, id_real, id_real_p, id_to_f, id_to_i, id_to_r, id_to_s;
+    id_denominator, id_divmod, id_eqeq_p, id_expt, id_fdiv,  id_floor,
+    id_idiv, id_imag, id_inspect, id_negate, id_numerator, id_quo,
+    id_real, id_real_p, id_to_f, id_to_i, id_to_r, id_to_s;
 
 #define f_boolcast(x) ((x) ? Qtrue : Qfalse)
 
@@ -170,14 +170,6 @@
 fun2(divmod)
 
 inline static VALUE
-f_equal_p(VALUE x, VALUE y)
-{
-    if (FIXNUM_P(x) && FIXNUM_P(y))
-	return f_boolcast(FIX2LONG(x) == FIX2LONG(y));
-    return rb_funcall(x, id_equal_p, 1, y);
-}
-
-inline static VALUE
 f_eqeq_p(VALUE x, VALUE y)
 {
     if (FIXNUM_P(x) && FIXNUM_P(y))
@@ -894,24 +886,6 @@
  * call-seq:
  *    cmp == object  ->  true or false
  *
- * Returns true if cmp is same as object.
- */
-static VALUE
-nucomp_equal_p(VALUE self, VALUE other)
-{
-    if (k_complex_p(other)) {
-	get_dat2(self, other);
-
-	return f_boolcast(f_equal_p(adat->real, bdat->real) &&
-			  f_equal_p(adat->imag, bdat->imag));
-    }
-    return Qfalse;
-}
-
-/*
- * call-seq:
- *    cmp == object  ->  true or false
- *
  * Returns true if cmp equals object numerically.
  */
 static VALUE
@@ -1831,7 +1805,6 @@
     id_convert = rb_intern("convert");
     id_denominator = rb_intern("denominator");
     id_divmod = rb_intern("divmod");
-    id_equal_p = rb_intern("equal?");
     id_eqeq_p = rb_intern("==");
     id_expt = rb_intern("**");
     id_fdiv = rb_intern("fdiv");
@@ -1901,7 +1874,6 @@
     rb_define_method(rb_cComplex, "fdiv", nucomp_fdiv, 1);
     rb_define_method(rb_cComplex, "**", nucomp_expt, 1);
 
-    rb_define_method(rb_cComplex, "equal?", nucomp_equal_p, 1);
     rb_define_method(rb_cComplex, "==", nucomp_eqeq_p, 1);
     rb_define_method(rb_cComplex, "coerce", nucomp_coerce, 1);
 
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 23947)
+++ ChangeLog	(revision 23948)
@@ -1,3 +1,7 @@
+Fri Jul  3 21:30:14 2009  Tadayoshi Funaba  <tadf@d...>
+
+	* complex.c (nucomp_equal_p): removed.
+
 Fri Jul  3 21:07:29 2009  Tadayoshi Funaba  <tadf@d...>
 
 	* rational.c: renamed equal_p to eqeq_p.
Index: test/ruby/test_complex.rb
===================================================================
--- test/ruby/test_complex.rb	(revision 23947)
+++ test/ruby/test_complex.rb	(revision 23948)
@@ -488,18 +488,6 @@
     assert_raise(NoMethodError){Complex(1,1) <=> Complex(1,1)}
   end
 
-  def test_equal
-    unless @unify
-      assert_equal(true, Complex(1,0).equal?(Complex(1)))
-      assert_equal(false, Complex(1,0).equal?(Complex(1.0)))
-      if (0.0/0).nan?
-	nan = 0.0/0
-	assert_equal(true, Complex(nan).equal?(Complex(nan)))
-	assert_equal(false, Complex(nan).equal?(nan))
-      end
-    end
-  end
-
   def test_eqeq
     assert(Complex(1,0) == Complex(1))
     assert(Complex(-1,0) == Complex(-1))

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

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