ruby-changes:14026
From: takano32 <ko1@a...>
Date: Wed, 18 Nov 2009 12:06:53 +0900 (JST)
Subject: [ruby-changes:14026] Ruby:r25836 (trunk): * math.c (math_gamma): fix incorrect comparison expression.
takano32 2009-11-18 12:06:32 +0900 (Wed, 18 Nov 2009) New Revision: 25836 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25836 Log: * math.c (math_gamma): fix incorrect comparison expression. see also [ruby-dev:39709] [Bug #2381] Modified files: trunk/ChangeLog trunk/math.c Index: math.c =================================================================== --- math.c (revision 25835) +++ math.c (revision 25836) @@ -666,14 +666,13 @@ }; double d0, d; double intpart, fracpart; - int n; Need_Float(x); d0 = RFLOAT_VALUE(x); fracpart = modf(d0, &intpart); if (fracpart == 0.0 && - 0 < intpart && - (n = (int)intpart - 1) < numberof(fact_table)) { - return DBL2NUM(fact_table[n]); + 0 < intpart && + intpart - 1 < (double)numberof(fact_table)) { + return DBL2NUM(fact_table[(int)intpart - 1]); } errno = 0; d = tgamma(d0); Index: ChangeLog =================================================================== --- ChangeLog (revision 25835) +++ ChangeLog (revision 25836) @@ -1,3 +1,8 @@ +Wed Nov 18 11:57:32 2009 TAKANO Mitsuhiro (takano32) <tak@n...> + + * math.c (math_gamma): fix incorrect comparison expression. + see also [ruby-dev:39709] [Bug #2381] + Wed Nov 18 11:37:05 2009 NARUSE, Yui <naruse@r...> * io.c (rb_scan_open_args): move path encoding conversion -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/