[R] precision of gamma function

Spencer Graves spencer.graves at structuremonitoring.com
Wed Feb 9 16:41:45 CET 2011


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 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.
> How could I solve this problem? Thank you beforehand.
>
> Chuse.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list