summaryrefslogtreecommitdiff
path: root/math.c
diff options
context:
space:
mode:
Diffstat (limited to 'math.c')
-rw-r--r--math.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/math.c b/math.c
index 2b877ec..1a448b8 100644
--- a/math.c
+++ b/math.c
@@ -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);