summaryrefslogtreecommitdiff
path: root/math.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-14 23:34:39 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-14 23:34:39 (GMT)
commit573772ab5b143eae7130c2dd3bc9f6f221d0c742 (patch)
treeb5787349417ad232261ff18a8224f2c56002d578 /math.c
parent3f16e7dd7ff9ad61dd58f12a5617bd8717c64912 (diff)
math.c: more robust
* math.c (math_gamma): make more robust against addition/removal. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'math.c')
-rw-r--r--math.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/math.c b/math.c
index 011581a..a41fdb5 100644
--- a/math.c
+++ b/math.c
@@ -836,12 +836,10 @@ mingw_tgamma(const double d)
*
*/
-#define NFACT_TABLE 23
-
static VALUE
math_gamma(VALUE obj, VALUE x)
{
- static const double fact_table[NFACT_TABLE] = {
+ static const double fact_table[] = {
/* fact(0) */ 1.0,
/* fact(1) */ 1.0,
/* fact(2) */ 2.0,
@@ -869,6 +867,7 @@ math_gamma(VALUE obj, VALUE x)
* impossible to represent exactly in IEEE 754 double which have
* 53bit mantissa. */
};
+ enum {NFACT_TABLE = numberof(fact_table)};
double d;
d = Get_Double(x);
/* check for domain error */