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

ruby-changes:12302

From: tadf <ko1@a...>
Date: Wed, 8 Jul 2009 23:18:18 +0900 (JST)
Subject: [ruby-changes:12302] Ruby:r23996 (trunk): * complex.c (nucomp_div): omitted zero division check.

tadf	2009-07-08 23:18:02 +0900 (Wed, 08 Jul 2009)

  New Revision: 23996

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

  Log:
    * complex.c (nucomp_div): omitted zero division check.

  Modified files:
    trunk/ChangeLog
    trunk/complex.c

Index: complex.c
===================================================================
--- complex.c	(revision 23995)
+++ complex.c	(revision 23996)
@@ -758,8 +758,10 @@
 static VALUE
 nucomp_div(VALUE self, VALUE other)
 {
-    if (f_zero_p(other))
+#if 0 /* too much cost */
+    if (f_zero_p(other) && k_exact_p(self) && k_exact_p(other))
 	rb_raise_zerodiv();
+#endif
     return f_divide(self, other, f_quo, id_quo);
 }
 
@@ -824,7 +826,7 @@
 static VALUE
 nucomp_expt(VALUE self, VALUE other)
 {
-    if (k_exact_p(other) && f_zero_p(other))
+    if (f_zero_p(other) && k_exact_p(other))
 	return f_complex_new_bang1(CLASS_OF(self), ONE);
 
     if (k_rational_p(other) && f_one_p(f_denominator(other)))
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 23995)
+++ ChangeLog	(revision 23996)
@@ -1,3 +1,7 @@
+Wed Jul  8 23:13:54 2009  Tadayoshi Funaba  <tadf@d...>
+
+	* complex.c (nucomp_div): omitted zero division check.
+
 Wed Jul  8 21:00:37 2009  Keiju Ishitsuka  <keiju@e...>
 
 	* lib/irb/inspector.rb: forget svn add.

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

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