R/factorial.R

Defines functions truncfactorial

Documented in truncfactorial

#' @title Truncated factorial to avoid stack overflow for huge values
#' @description truncated factorial to avoid stack overflow for huge values
#' @param x a non-negative integer number
#' @return \code{truncfactorial(x)}, truncated factorial as min(x!,171!)
#' @examples truncfactorial(10)
#' @export
#' @keywords methods models
truncfactorial <- function(x) ifelse(x <= 170, gamma(abs(x) + 1), gamma(171))

Try the EMJMCMC package in your browser

Any scripts or data that you put into this service are public.

EMJMCMC documentation built on June 22, 2024, 11:34 a.m.