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

ruby-changes:37889

From: gogotanaka <ko1@a...>
Date: Sun, 15 Mar 2015 02:37:50 +0900 (JST)
Subject: [ruby-changes:37889] gogotanaka:r49970 (trunk): * math.c (math_gamma): rename NGAMMA_TABLE to NFACT_TABLE.

gogotanaka	2015-03-15 02:37:38 +0900 (Sun, 15 Mar 2015)

  New Revision: 49970

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

  Log:
    * math.c (math_gamma): rename NGAMMA_TABLE to NFACT_TABLE.
      specify the size of the fact_table.

  Modified files:
    trunk/math.c
Index: math.c
===================================================================
--- math.c	(revision 49969)
+++ math.c	(revision 49970)
@@ -836,12 +836,12 @@ mingw_tgamma(const double d) https://github.com/ruby/ruby/blob/trunk/math.c#L836
  *
  */
 
-#define NGAMMA_TABLE 23
+#define NFACT_TABLE 23
 
 static VALUE
 math_gamma(VALUE obj, VALUE x)
 {
-    static const double fact_table[] = {
+    static const double fact_table[NFACT_TABLE] = {
         /* fact(0) */ 1.0,
         /* fact(1) */ 1.0,
         /* fact(2) */ 2.0,
@@ -875,7 +875,7 @@ math_gamma(VALUE obj, VALUE x) https://github.com/ruby/ruby/blob/trunk/math.c#L875
     if (isinf(d) && signbit(d)) domain_error("gamma");
     if (d == floor(d)) {
 	if (d < 0.0) domain_error("gamma");
-	if (1.0 <= d && d <= (double)NGAMMA_TABLE) {
+	if (1.0 <= d && d <= (double)NFACT_TABLE) {
 	    return DBL2NUM(fact_table[(int)d - 1]);
 	}
     }

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

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