Post Reply 
(HP65) Factorial and Gamma Function
10-22-2017, 05:28 PM (This post was last modified: 10-22-2017 05:28 PM by Dieter.)
Post: #6
RE: (HP65) Factorial and Gamma Function
(10-22-2017 02:40 AM)Gamo Wrote:  Your quick modification is very good with more accurate approximation.

Here is an improved version. If uses a different technique to prevent overflow during the calculation of xx · e–x. In your program and my first version this is done with two consecutive multiplications of xx/2, while now this term has been rearranged to (x/e)x:

Code:
LBL A
8
EEX
4
1/x
CHS
STO 1
.
0
0
2
6
9
6
CHS
STO 2
2
8
8
1/x
STO 3
1
2
1/x
STO 4
CLX
RTN
LBL E
6
STO 0
STO/0
X<>Y
LBL 1
x>y?
GTO 2
1
+
STO*0
GTO 1
LBL 2
ENTER
ENTER
ENTER
1
CHS
e^x
*
X<>Y
Y^X
X<>Y
2
*
PI
*
SQRT
*
RCL 0
/
RCL 1
R↑
/
RCL 2
+
R↑
/
RCL 3
+
R↑
/
RCL 4
+
R↑
/
1
+
*
RTN

The program also no longer requires R5 and R6, most of the calculation is done on the stack.

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(HP65) Factorial and Gamma Function - Gamo - 10-21-2017, 08:32 AM
RE: (HP65) Factorial and Gamma Function - Dieter - 10-22-2017 05:28 PM



User(s) browsing this thread: 2 Guest(s)