The Museum of HP Calculators


Log of large Factorials (Nemes' formula) for the HP-11C/15C

This program is by P. J. Schüngel and is used here by permission.

This program is supplied without representation or warranty of any kind. P. J. Schüngel and The Museum of HP Calculators therefore assume no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof.

Overview

Calculates log(n!) for large numbers using G. Nemes' approach (simpler and numerically less sensitive than Stirling), www.rskey.org/gamma.htm Uses only the stack (no registers)

Input: n
Output: log(n!) to better than 1e-9 relative accuracy, n in Y, Z and T

32 Bytes, no flags or storage registers required

Would also work on the -34C. Does not work on the 10C (no R↑ function)

Listing

000
001 LBL B
002 LOG
003 LASTX
004 ×
005 .
006 4
007 LASTX
008 ÷
009 1
010 2
011 LASTX
012 ×
013 LASTX
014 R↓
015 +
016 1/X
017 R↑
018 -
019 1
020 ex
021 LOG
022 ×
023 +
024 2
025 R↑
026 ×
027 π
028 ×
029 √x
030 LOG
031 +
032 RTN

Go back to the software library
Go back to the main exhibit hall