Post Reply 
Example Program to calculate Factorial
02-02-2018, 08:44 AM
Post: #20
RE: Example Program to calculate Factorial
(02-02-2018 05:05 AM)Thomas Okken Wrote:  It is possible that the ROM uses a better algorithm, but in the case of n!, I think the basic multiplication is used everywhere.

Now take a real (hardware) HP35s and calculate a few factorials:

100! ... 120! ... 150! ... the calculation takes about one second until the result is displayed. Then continue:
155! ... 157! ... 158! ... again, it takes about 1½ seconds.
159! ... 160! ... and now the answer is returned almost immediately. Up to 253! it gets only slightly slower, finally about half a second is required. So 250! is about twice as fast as 150!.

What's going on there? Since the 35s factorial key also handles the Gamma function and Gamma is calculated faster than a simple factorial (yes – try 150! and 150,2!) I suspect this may be related to a fast Gamma code.

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


Messages In This Thread
RE: Example Program to calculate Factorial - Dieter - 02-02-2018 08:44 AM



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