Re: [R] precision of gamma function

2011-02-09 Thread Mike Marchywka
> Date: Wed, 9 Feb 2011 18:23:21 +0100 > From: savi...@praha1.ff.cuni.cz > To: r-help@r-project.org > Subject: Re: [R] precision of gamma function > > On Wed, Feb 09, 2011 at 05:23:27PM +0200, Chuse chuse wrote: > > Dear R

Re: [R] precision of gamma function

2011-02-09 Thread Petr Savicky
On Wed, Feb 09, 2011 at 05:23:27PM +0200, Chuse chuse wrote: > Dear R users, > > I have to calculate gamma functions for negative numbers beyond -171.4. > e.x. gamma(-500.4) > I got following: > > > gamma(-170.4) > [1] -5.824625e-308 > > gamma(-171.4) > [1] 0 > Warning message: > underflow occurr

Re: [R] precision of gamma function

2011-02-09 Thread Spencer Graves
Have you considered: (lg.170.4 <- lgamma(-170.4)) (lg.171.4 <- lgamma(-171.4)) The problem is documented with ".Machine$double.xmin" Hope this helps, Spencer On 2/9/2011 7:23 AM, Chuse chuse wrote: Dear R users, I have to calculate gamma functions for negative numbers b

Re: [R] precision of gamma function

2011-02-09 Thread Duncan Murdoch
On 09/02/2011 10:23 AM, Chuse chuse wrote: Dear R users, I have to calculate gamma functions for negative numbers beyond -171.4. e.x. gamma(-500.4) I got following: > gamma(-170.4) [1] -5.824625e-308 > gamma(-171.4) [1] 0 Warning message: underflow occurred in 'gammafn' I have tried to use a

[R] precision of gamma function

2011-02-09 Thread Chuse chuse
Dear R users, I have to calculate gamma functions for negative numbers beyond -171.4. e.x. gamma(-500.4) I got following: > gamma(-170.4) [1] -5.824625e-308 > gamma(-171.4) [1] 0 Warning message: underflow occurred in 'gammafn' I have tried to use a recursion getting values a little futher -180.