Skip to content

Commit

Permalink
* math.c (math_gamma): fix incorrect comparison expression.
Browse files Browse the repository at this point in the history
  see also [ruby-dev:39709] [Bug ruby#2381]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
takano32 committed Nov 18, 2009
1 parent 6c2373e commit a1c4d60
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Wed Nov 18 11:57:32 2009 TAKANO Mitsuhiro (takano32) <[email protected]>

* math.c (math_gamma): fix incorrect comparison expression.
see also [ruby-dev:39709] [Bug #2381]

Wed Nov 18 11:37:05 2009 NARUSE, Yui <[email protected]>

* io.c (rb_scan_open_args): move path encoding conversion
Expand Down
7 changes: 3 additions & 4 deletions math.c
Original file line number Diff line number Diff line change
Expand Up @@ -666,14 +666,13 @@ math_gamma(VALUE obj, VALUE x)
};
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);
Expand Down

0 comments on commit a1c4d60

Please sign in to comment.