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

ruby-changes:44685

From: mrkn <ko1@a...>
Date: Sun, 13 Nov 2016 00:43:22 +0900 (JST)
Subject: [ruby-changes:44685] mrkn:r56758 (trunk): rational.c: optimize (-rational).rationalize(some)

mrkn	2016-11-13 00:43:18 +0900 (Sun, 13 Nov 2016)

  New Revision: 56758

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56758

  Log:
    rational.c: optimize (-rational).rationalize(some)
    
    * rational.c (nurat_rationalize): optimize (-rational).rationalize(some).
      Author: Tadashi Saito <tad.a.digger@g...>

  Modified files:
    trunk/rational.c
Index: rational.c
===================================================================
--- rational.c	(revision 56757)
+++ rational.c	(revision 56758)
@@ -1616,8 +1616,8 @@ nurat_rationalize(int argc, VALUE *argv, https://github.com/ruby/ruby/blob/trunk/rational.c#L1616
     if (argc == 0)
 	return self;
 
-    if (f_negative_p(self))
-	return f_negate(nurat_rationalize(argc, argv, f_abs(self)));
+    if (nurat_negative_p(self))
+	return nurat_negate(nurat_rationalize(argc, argv, nurat_negate(self)));
 
     rb_scan_args(argc, argv, "01", &e);
     e = f_abs(e);

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

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