Faster inverse gamma and factorial for the WP 34S

02162015, 09:09 PM
(This post was last modified: 02162015 09:22 PM by Dieter.)
Post: #37




RE: Faster inverse gamma and factorial for the WP 34S
(02162015 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 finetuning 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. (02162015 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 

« Next Oldest  Next Newest »

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