Skip to content
Snippets Groups Projects
Commit 4209f86c authored by SANTAGOSTINI Pierre's avatar SANTAGOSTINI Pierre
Browse files

Function removed (base::lfactorial does the same, and runs faster)

parent 6f80f4e1
No related branches found
No related tags found
No related merge requests found
lnfactorial <- function(n) {
#' Logarithm of the factorial
#'
#' Computes the logarithm of the factorial of a positive integer.
#'
#' @aliases lnfactorial
#'
#' @usage lnfactorial(n)
#' @param n positive integer.
#' @return Numeric value. The logarithm of the factorial.
#' @author Pierre Santagostini, Nizar Bouhlel
#'
#' @export
if (n < 0) {
stop("n must be non negative")
}
if (n == 0) {
return(0)
}
if (n > 0) {
return(sum(log(1:n)))
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment