[Rd] error in dbeta (PR#970)

p.dalgaard@biostat.ku.dk p.dalgaard@biostat.ku.dk
Wed, 6 Jun 2001 19:12:33 +0200 (MET DST)


Prof Brian Ripley <ripley@stats.ox.ac.uk> writes:

> > > > dbeta((0:5)/5,1.3,1.0)
> > > [1] 0.0 0.0 0.0 0.0 0.0 1.3
> > > > dbeta((0:5)/5,1.30001,1.0)
> > > [1] 0.0000000 0.8021373 0.9875537 1.1152952 1.2158296 1.3000100
> > > > dbeta((0:5)/5,1.29999,1.0)
> > > [1] 0.0000000 0.8021508 0.9875566 1.1152895 1.2158163 1.2999900
> >
> > Hm. Doesn't happen with 1.2.3 on Linux and dbeta.c hasn't changed
> > inbetween. Any chance of getting you to step through the computations
> > with a debugger on you machine?
> 
> It does happen on Solaris 2.7, though, which might give Peter a means
> to look at it on an earlier Solaris.

Indeedy. Looks like we're passing a-1 and a+b-2 on to dbinom_raw as x
and n respectively and this comes out with x > n due to roundoff so we
get zero returned.

Argh, how does one fix that?

(It's usually the intel FPUs that pull that kind of stunt on us...)

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._