maths: make stirling inline rather than constexpr
stirling uses cmath functions which aren't constexpr, such as std::pow. this sometimes works under linux/gcc but fails under clang/freebsd
This commit is contained in:
parent
e17158b0bb
commit
60286202fd
@ -399,11 +399,13 @@ namespace util {
|
|||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
/// stirlings approximation of factorials
|
/// stirlings approximation of factorials
|
||||||
constexpr uintmax_t
|
inline uintmax_t
|
||||||
stirling (unsigned n)
|
stirling (unsigned n)
|
||||||
{
|
{
|
||||||
|
using real_t = double;
|
||||||
|
|
||||||
return static_cast<uintmax_t> (
|
return static_cast<uintmax_t> (
|
||||||
std::sqrt (2 * PI<float> * n) * std::pow (n / E<float>, n)
|
std::sqrt (2 * PI<real_t> * n) * std::pow (n / E<real_t>, n)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user