URL:
<http://savannah.gnu.org/bugs/?24897>
Summary: problem with large a in gsl_ran_beta
Project: GNU Scientific Library
Submitted by: bjg
Submitted on: Fri 21 Nov 2008 03:47:34 PM GMT
Category: Accuracy problem
Severity: 3 - Normal
Operating System:
Status: Confirmed
Assigned to: None
Open/Closed: Open
Release: 1.11
Discussion Lock: Any
_______________________________________________________
Details:
From: "Wang, Frank" <[EMAIL PROTECTED]>
Subject: RE: [Bug-gsl] bug with function gsl_ran_beta
Date: Tue, 18 Nov 2008 18:59:54 -0400
Hi Ralph,
Thank you very much for your quick response.
The problem is cuased by the truncation of double to unsiged int in the
function gsl_ran_gamma() in file gamma.c:
double
gsl_ran_gamma (const gsl_rng * r, const double a, const double b)
{
/* assume a > 0 */
unsigned int na = floor (a);
//Frank Wang add 11/18/2008 for fix bug when big a is inputed
if(a >= UINT_MAX )
return b*(gamma_large(r, floor(a)) + gamma_frac(r, a - floor(a)) );
if (a == na)
{
return b * gsl_ran_gamma_int (r, na);
}
else if (na == 0)
{
return b * gamma_frac (r, a);
}
else
{
return b * (gsl_ran_gamma_int (r, na) + gamma_frac (r, a - na)) ;
}
}
When this fix is applied, I get simulation compatible with R or Matlab.
Best Regards,
Frank
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?24897>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
_______________________________________________
Bug-gsl mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-gsl