From: Nobuyoshi Nakada Date: 2009-09-02T14:39:41+09:00 Subject: [ruby-core:25262] Re: [Bug #2030] Math.gamma(x) seg faults for integer x larger than 2<<63-1 Hi, At Wed, 2 Sep 2009 14:30:25 +0900, Hiro Asari wrote in [ruby-core:25261]: > That could very well be dependent. I used GCC came with Snow Leopard. > > Indeed, I still have 1.9.1 that I built with 10.5.7, and it appears to be OK. > > $ ~/.multiruby/install/1.9.1-p243/bin/ruby -v -e 'puts Math.gamma(2<<256)' > ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin9.7.0] > Infinity > > If this is a compiler option-dependent issue, then I don't think it's worth it pursue it any further. Does this patch fix it? And, could you show the result of: make math.S && sed -n '/^_math_gamma:/,/^[._]/p' math.S Index: math.c =================================================================== --- math.c (revision 24737) +++ math.c (working copy) @@ -669,5 +669,5 @@ math_gamma(VALUE obj, VALUE x) if (fracpart == 0.0 && 0 < intpart && - (size_t)intpart <= sizeof(fact_table)/sizeof(*fact_table)) { + intpart <= (double)sizeof(fact_table)/sizeof(*fact_table)) { return DBL2NUM(fact_table[(int)intpart - 1]); } -- Nobu Nakada