[Top][All Lists]

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

Re: [Bug-gsl] inaccurate tabulated values in gsl-1.11/randist/gausszig.c

From: Brian Gough
Subject: Re: [Bug-gsl] inaccurate tabulated values in gsl-1.11/randist/gausszig.c
Date: Tue, 06 May 2008 21:17:55 +0100
User-agent: Wanderlust/2.14.0 (Africa) Emacs/22.1 Mule/5.0 (SAKAKI)

At Fri, 2 May 2008 10:22:40 -0700 (PDT),
Joseph Pang wrote:
> The tables in the above file, implementing the Ziggurat method for
> Gaussian, carry inaccurate numerical values.  The problem is most
> likely due to the inaccurate value of PARAM_R, which is defined as
> 3.44428647676.
> The accurate value should be 3.442619855899.  Even though the
> difference seems small, it affects all the values in all the tables
> to various degree.  The extent of this impact to the accuracy of
> user programs is not known.  By the way, the accurate value did
> appear in the original paper by Marsaglia and Tsang.
> The reason for the inaccurate values is due to the use of erfc
> approximation in the original C program that generates the Ziggurat
> tables ( I dug up that C program somewhere from the Web).  It is
> easy to fix by using the accurate erfc function in this program to
> re-generate the tabulated values.

Thanks for your email.  In the gausszig.c file there was a note which

   * 2) use an acceptance sampling from an exponential wedge
   * exp(-R*(x-R/2)) for the tail of the base strip to simplify the
   * implementation.  The area of exponential wedge is used in
   * calculating 'v' and the coefficients in ziggurat table, so the
   * coefficients differ slightly from those in the Marsaglia and
   * Tsang paper.

Do your comments still stand after taking this into account?

Brian Gough

reply via email to

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