[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tolerance in binopdf.m
From: |
Tatsuro MATSUOKA |
Subject: |
Re: tolerance in binopdf.m |
Date: |
Wed, 21 Sep 2011 13:16:28 +0900 (JST) |
Hello
On my mingw build, gammaln is implemented as the libcruft/slatec-fn routine.
--- On Wed, 2011/9/21, Ben Abbott wrote:
> > For reference, the fist problematic test ...
> >
> > x = [-1 0 1 2 3];
> > y = [0 1/4 1/2 1/4 0];
> > z = binopdf (x, 2 * ones (1, 5), 0.5 * ones (1, 5));
> > z - y
> > ans = 0.0000e+00 0.0000e+00 1.1102e-16 0.0000e+00 0.0000e+00
octave:3> x = [-1 0 1 2 3];
octave:4> y = [0 1/4 1/2 1/4 0];
octave:5> z = binopdf (x, 2 * ones (1, 5), 0.5 * ones (1, 5));
octave:6> z - y
ans =
NaN 0 0 0 NaN
>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
octave:8> exp (gammaln (3)) * exp (2 * log (0.5)) - 0.5
ans = 0
octave:10> exp (gammaln (3) + 2 * log (0.5)) - 0.5
ans = 0
> Looking at these individually ...
>
> printf ("%.17f\n", log (0.5))
> -0.69314718055994529
> printf ("%.17f\n", gammaln (3))
> 0.69314718055994540
octave:11> printf ("%.17f\n", log (0.5))
-0.69314718055994529
octave:12> printf ("%.17f\n", gammaln (3))
0.69314718055994529
Regards
Tatsuro
- Overhaul of statistical distribution functions, Rik, 2011/09/20
- Re: Overhaul of statistical distribution functions, Ben Abbott, 2011/09/20
- Re: Overhaul of statistical distribution functions, Michael D Godfrey, 2011/09/20
- Re: tolerance in binopdf.m, Rik, 2011/09/20
- Re: tolerance in binopdf.m, Ben Abbott, 2011/09/20
- Re: tolerance in binopdf.m, Ben Abbott, 2011/09/20
- Re: tolerance in binopdf.m, Jordi Gutiérrez Hermoso, 2011/09/21
- Re: tolerance in binopdf.m,
Tatsuro MATSUOKA <=
- Re: tolerance in binopdf.m, Michael D Godfrey, 2011/09/21
- Re: tolerance in binopdf.m, Ben Abbott, 2011/09/21
- Re: tolerance in binopdf.m, Rik, 2011/09/21
- Re: tolerance in binopdf.m, Marco Atzeri, 2011/09/21
- Re: tolerance in binopdf.m, Jordi Gutiérrez Hermoso, 2011/09/21
- Re: tolerance in binopdf.m, Michael D Godfrey, 2011/09/21
- Re: tolerance in binopdf.m, Michael D Godfrey, 2011/09/21
- Re: tolerance in binopdf.m, Ben Abbott, 2011/09/21
- Re: tolerance in binopdf.m, Ben Abbott, 2011/09/21
- Re: tolerance in binopdf.m, Marco atzeri, 2011/09/21