Post Reply 
Faster inverse gamma and factorial for the WP 34S
02-16-2015, 09:09 PM (This post was last modified: 02-16-2015 09:22 PM by Dieter.)
Post: #37
RE: Faster inverse gamma and factorial for the WP 34S
(02-16-2015 08:46 PM)Paul Dale Wrote:  I don't think I ever tuned up the C version of the digamma routine. The series expansion there is relatively short and aimed for single precision. The XROM version uses significantly more terms (if you are in double precision).

Yes, I just looked at the code in digamma.wp34s.

Generally there is a tradeoff between the number of terms used and the threshold for the minimum x used for the series. The current version has a constant threshold of 10 (SP) resp. 20 (DP) and a fixed number of terms in the series. This number of terms can be substantially reduced if the threshold is increased. I am using 16 in SP resp. 256 (!) in DP, combined with merely six terms (up to x^12) with good results and a similar accuracy level (cf. my reply to Bit's post).

IMHO fine-tuning this relation (threshold vs. number of terms) is the clue to adequate accuracy. The major relevant problem that still exists is accuracy for results very close to zero. Some additional digits can be squeezed out by carefully rearranging the order intermediate results are added together. But much is lost due to digit cancelling, so a certain absolute error remains. Which reduces the number of valid digits in results close to zero.

(02-16-2015 08:46 PM)Paul Dale Wrote:  I also don't remember why I stored the series constants as reciprocals in XROM -- probably saving a few bytes but slower.

I wonder where these constants (recalled by CNST→J) are stored. Is it possible to generate custom constants in XROM code?

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


Messages In This Thread
RE: Faster inverse gamma and factorial for the WP 34S - Dieter - 02-16-2015 09:09 PM



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