=== modified file 'randist/chisq.c' --- randist/chisq.c 2007-09-10 18:09:35 +0000 +++ randist/chisq.c 2010-11-10 13:19:34 +0000 @@ -39,16 +39,23 @@ double gsl_ran_chisq_pdf (const double x, const double nu) { - if (x <= 0) + if (x < 0) { return 0 ; } else { - double p; - double lngamma = gsl_sf_lngamma (nu / 2); - - p = exp ((nu / 2 - 1) * log (x/2) - x/2 - lngamma) / 2; - return p; + if(nu == 2.0) + { + return exp(-x/2.0 - log(2.0)); + } + else + { + double p; + double lngamma = gsl_sf_lngamma (nu / 2); + + p = exp ((nu / 2 - 1) * log (x/2) - x/2 - lngamma) / 2; + return p; + } } }