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

ruby-changes:50438

From: nobu <ko1@a...>
Date: Sat, 24 Feb 2018 11:45:16 +0900 (JST)
Subject: [ruby-changes:50438] nobu:r62556 (trunk): rational.c: removed needless calc

nobu	2018-02-24 11:45:12 +0900 (Sat, 24 Feb 2018)

  New Revision: 62556

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

  Log:
    rational.c: removed needless calc
    
    * rational.c (read_num): exp(0) is 1, no need to multiply.

  Modified files:
    trunk/rational.c
Index: rational.c
===================================================================
--- rational.c	(revision 62555)
+++ rational.c	(revision 62556)
@@ -2437,7 +2437,7 @@ read_num(const char **s, const char *con https://github.com/ruby/ruby/blob/trunk/rational.c#L2437
 		    *div = f_expt10(negate_num(exp));
 		}
 		else {
-		    *num = rb_int_mul(n, f_expt10(exp));
+		    if (exp != ZERO) *num = rb_int_mul(n, f_expt10(exp));
 		    *div = ONE;
 		}
 	    }

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

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