bugGNU Scientific Library - Bugs: bug #24897, problem with large a in...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #24897: problem with large a in gsl_ran_beta

Submitter:  -Deleted Account- <bjg>
Submitted:  Fri 21 Nov 2008 03:47:34 PM UTC
   
 
Category:  Accuracy problem Severity:  3 - Normal
Operating System:  Status:  Fixed
Assigned to:  None Open/Closed:  Closed
Release:  1.11

Sun 30 Nov 2008 09:26:00 AM UTC, comment #1: 

fixed by 210a09f8b02ad88ce949e8d56cccf89c93e877af

-Deleted Account- <bjg>
Fri 21 Nov 2008 03:47:34 PM UTC, original submission:  

From: "Wang, Frank" <frank.wang@validusre.bm>
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

-Deleted Account- <bjg>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Follow 2 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2008-11-30 bjg Open/ClosedOpen Closed
2008-11-30 bjg StatusConfirmed Fixed

Back to the top

Powered by Savane 3.13-f8d8.
Corresponding source code