[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-gsl] [bug #24897] problem with large a in gsl_ran_beta

From: Brian Gough
Subject: [Bug-gsl] [bug #24897] problem with large a in gsl_ran_beta
Date: Fri, 21 Nov 2008 15:47:35 +0000
User-agent: Emacs-w3m/1.4.4 w3m/0.5.2


                 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



From: "Wang, Frank" <address@hidden>
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:

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);
      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,



Reply to this item at:


  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]