Re: Factorials and the 35s Message #2 Posted by David Hayden on 20 Oct 2010, 9:44 a.m., in response to message #1 by Dieter
Quote:
However, the more interesting part is the obvious switch between two different algorithms that seems to take place near x=158 since 158! is slow while 159! is much faster.
I'm going to guess that there are actually two algorithms, one that multiplies integers and one that computes gamma. It uses the first algo for nonnegative integers less than 159 and the second for all other numbers.
The slow processing speed may be due to the fact that it's doing BCD arithmetic, but I'm just speculating there. I don't know the details of the processor, but it does seem rather slow.
Continuing my speculation, when using the gamma function, they might convert the BCD number to binary and then compute gamma using binary arithmetic, which is usually much faster. When done, the would convert the result back. This might explain why gamma is pretty fast.
Dave
