octave-maintainers
[Top][All Lists]
Advanced

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

Re: tolerance in binopdf.m


From: Rik
Subject: Re: tolerance in binopdf.m
Date: Tue, 20 Sep 2011 22:23:45 -0700

On 09/20/2011 08:50 PM, Ben Abbott wrote:
> On Sep 20, 2011, at 9:03 PM, Ben Abbott wrote:
> More info on this particular test. After some simplification ...
>
> exp (gammaln (3)) * exp (2 * log (0.5)) - 0.5
> ans = 0
> exp (gammaln (3) + 2 * log (0.5)) - 0.5
> ans =  1.1102e-16
>
> I'm not sure the simplification below is immune to roundoff, but ...
>
> gammaln (3) + log (0.5)
> ans =  1.1102e-16
>
> (fwiw, I get the same result with ML)
>
> Looking at these individually ...
>
> printf ("%.17f\n", log (0.5))
> -0.69314718055994529
>  printf ("%.17f\n", gammaln (3))
> 0.69314718055994540
>
> Does anyone have any insight regarding this?
>
> What does Linux give for these two?
Ubuntu 10.04 with libc 2.11.1 gives 0 everywhere you would expect it to. 
In particular,

 printf ("%.17f\n", gammaln (3))

0.69314718055994529

As Jordi pointed out, for my system HAVE_LGAMMA=1 is defined so I should be
grabbing it from libc.

--Rik


reply via email to

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