[R] precision of double in R
Duncan Murdoch
murdoch at stats.uwo.ca
Sat Nov 12 00:01:06 CET 2005
On 11/11/2005 9:55 AM, Burkhard Heil wrote:
> Hello Everybody!
>
>
>
> I'm working on biological sequences and their alignements. I can't get
> around calculating something in the size of choose(1000,500) or 0.02^250.
> The result is either INF or 0 in the latter case. Is their any data type in
> R to calculate these things. Or some other solution?
Use logs. log(0.02^250) is easy to calculate as 250*log(0.02). There's
also an lchoose() function; it gives
> lchoose( 1000, 500)
[1] 689.4673
without complaining.
Duncan Murdoch
More information about the R-help
mailing list