MCPcopy Create free account
hub / github.com/RobTillaart/Arduino / stirling

Function stirling

libraries/statHelpers/statHelpers.cpp:184–188  ·  view source on GitHub ↗

stirling is an approximation function for factorial(n). it is slower but constant in time. float => 26! double => 143!

Source from the content-addressed store, hash-verified

182// float => 26!
183// double => 143!
184double stirling(uint8_t n)
185{
186 double v = exp(-n) * pow(n, n) * sqrt(TWO_PI * n);
187 return v;
188}
189
190
191// SEMIFACTORIAL

Callers 1

unittestFunction · 0.85

Calls 1

sqrtFunction · 0.85

Tested by 1

unittestFunction · 0.68