[R] The gamma function and infinity

Peter Dalgaard p.dalgaard at biostat.ku.dk
Mon Dec 5 17:14:47 CET 2005


Florent Bresson <f_bresson at yahoo.fr> writes:

> I have to calculate some formula like:
> 
> gamma(x)/(gamma(x+y)
> 
> and I observed that for relatively big values of x, R
> returns infinity and so cannot compute the formula. Is
> it possible to force  R to give the real value of
> gamma(x) instead of Inf ?

No, it is overflowing the floating point representation.

How about using lgamma? That's basically what it is for.

-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907




More information about the R-help mailing list