[R] how to calculate this natural logarithm

cgw at witthoft.com cgw at witthoft.com
Sun Jan 9 13:57:49 CET 2011



   You could re-do part of your code to run with mpfr-class variables, and  use
   this function:
   # mpfr choose(n,k)
    rmpfac<-function(n,k,prec=50)
   factorial(mpfr(n,prec))/factorial(mpfr(k,prec))/factorial(mpfr(n-k,prec))
   Converting into and out of mpfr may not be worth it, but you will get all
   the precision you want without any nasty "Inf" results
   :-)
   Carl


More information about the R-help mailing list