You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If this is true, it should substantially improve the efficiency of logFactorial. Even if it is not quite true for n=256, it should become true for larger values of n. Cook also recommends using a table for values of n under around 256. His sample code uses a very slightly smaller table for unstated reasons. If a 256-entry table is judged too large for some reason, it would still pay to use a small table for the values currently calculated by sum of logs, cut over to the current approximation, and then finally cut over to Cook's suggestion (or similar).
The text was updated successfully, but these errors were encountered:
John D. Cook claims at http://www.johndcook.com/blog/2010/08/16/how-to-compute-log-factorial/ that for values of n over approximately 256, it should be sufficient to use the approximation
log(x!) ~= (x – 1/2) log(x) – x + (1/2) log(2 π) + 1/(12 x).
If this is true, it should substantially improve the efficiency of logFactorial. Even if it is not quite true for n=256, it should become true for larger values of n. Cook also recommends using a table for values of n under around 256. His sample code uses a very slightly smaller table for unstated reasons. If a 256-entry table is judged too large for some reason, it would still pay to use a small table for the values currently calculated by sum of logs, cut over to the current approximation, and then finally cut over to Cook's suggestion (or similar).
The text was updated successfully, but these errors were encountered: