Automatic Differentiation
 
Loading...
Searching...
No Matches
lgamma_stirling.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_LGAMMA_STIRLING_HPP
2#define STAN_MATH_PRIM_FUN_LGAMMA_STIRLING_HPP
3
8#include <cmath>
9
10namespace stan {
11namespace math {
12
25template <typename T>
27 return HALF_LOG_TWO_PI + (x - 0.5) * log(x) - x;
28}
29
30} // namespace math
31} // namespace stan
32
33#endif
typename return_type< Ts... >::type return_type_t
Convenience type for the return type of the specified template parameters.
fvar< T > log(const fvar< T > &x)
Definition log.hpp:15
return_type_t< T > lgamma_stirling(const T x)
Return the Stirling approximation to the lgamma function.
static constexpr double HALF_LOG_TWO_PI
The value of half the natural logarithm , .
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...