Why not just use the lgamma
function for the log of the factorial, since this already supports BigFloat
with arbitrary precision?
You have to be careful with Stirling at arbitrary precision since it is an asymptotic series (i.e. the more precision you want, the bigger n
needs to be).