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

ruby-changes:30808

From: akr <ko1@a...>
Date: Sun, 8 Sep 2013 16:02:49 +0900 (JST)
Subject: [ruby-changes:30808] akr:r42887 (trunk): * rational.c (f_gcd): Relax the condition to use GMP.

akr	2013-09-08 16:02:42 +0900 (Sun, 08 Sep 2013)

  New Revision: 42887

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

  Log:
    * rational.c (f_gcd): Relax the condition to use GMP.

  Modified files:
    trunk/ChangeLog
    trunk/rational.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 42886)
+++ ChangeLog	(revision 42887)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Sep  8 16:01:54 2013  Tanaka Akira  <akr@f...>
+
+	* rational.c (f_gcd): Relax the condition to use GMP.
+
 Sun Sep  8 13:56:38 2013  Masaki Suketa <masaki.suketa@n...>
 
 	* ext/win32ole/win32ole.c (folevariant_initialize): check type of
Index: rational.c
===================================================================
--- rational.c	(revision 42886)
+++ rational.c	(revision 42887)
@@ -379,7 +379,7 @@ f_gcd(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/rational.c#L379
     if (TYPE(x) == T_BIGNUM && TYPE(y) == T_BIGNUM) {
         long xn = RBIGNUM_LEN(x);
         long yn = RBIGNUM_LEN(y);
-        if (GMP_GCD_DIGITS <= xn && GMP_GCD_DIGITS <= yn)
+        if (GMP_GCD_DIGITS <= xn || GMP_GCD_DIGITS <= yn)
             return rb_gcd_gmp(x, y);
     }
 #endif

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

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