### gnm_digamma: fix step-down range to use either series 2 or 3 at the end.

```We end up somewhere in the range [x0,x0+1].  For the first third of that
range it's better to use series 2.```
parent 14391c96
 ... ... @@ -1536,7 +1536,7 @@ fixup_upper_real (gnm_complex *res, gnm_complex a, gnm_complex z) if (GNM_CREALP (z) && z.re < 0 && GNM_CREALP (a) && a.re != gnm_floor (a.re)) { // Everything in the lower power series is real expect z^a // Everything in the lower power series is real except z^a // which is not. So... // 1. Flip to lower gamma // 2. Assume modulus is correct ... ... @@ -1914,24 +1914,24 @@ gnm_digamma (gnm_float x) return gnm_digamma_series_1 (x); if (x < x0a + 1.0 / 3.0) // Series for range [1.13,1.79] around x0 // Series for range [1.13;1.79] around x0 // Take extra care to compute the difference to x0 with a high- // precision version of x0 return gnm_digamma_series_2 (x, (x - x0a) - x0b); if (x < x0a + 1) // Series for range [1.79,2.46] // Series for range [1.79;2.46] return gnm_digamma_series_3 (x); if (x < 20) { // Step down to series 3. All terms are positive so no // Step down to series 2 or 3. All terms are positive so no // cancellation. gnm_float sum = 0; while (x > x0a + 1) { x--; sum += 1.0 / x; } return sum + gnm_digamma_series_3 (x); return sum + gnm_digamma (x); } return gnm_digamma_asymp (x); ... ...
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment
{"ft_lang_label":"__label__en","ft_lang_prob":0.83201605,"math_prob":0.96638304,"size":241,"snap":"2019-35-2019-39","text_gpt3_token_len":70,"char_repetition_ratio":0.13502109,"word_repetition_ratio":0.0,"special_character_ratio":0.2821577,"punctuation_ratio":0.094339624,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9747656,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-08-18T19:36:01Z\",\"WARC-Record-ID\":\"<urn:uuid:825f5538-9eeb-4cd4-aa66-ba4925a41e4b>\",\"Content-Length\":\"90158\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:b3f47e99-6958-4129-b4f6-21e08e736849>\",\"WARC-Concurrent-To\":\"<urn:uuid:6536b889-d83a-441c-a160-c28cc668da25>\",\"WARC-IP-Address\":\"209.132.180.181\",\"WARC-Target-URI\":\"https://gitlab.gnome.org/GNOME/gnumeric/commit/5a64e1b4ddd24ab248d4ea302497992892189f27\",\"WARC-Payload-Digest\":\"sha1:H24CG5DELILRCWRPT4556AFSOYNAE4X4\",\"WARC-Block-Digest\":\"sha1:VSPQNKOE7X24LDVA62E5CMCQ3U27QRJS\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-35/CC-MAIN-2019-35_segments_1566027313996.39_warc_CC-MAIN-20190818185421-20190818211421-00402.warc.gz\"}"}