On 10/25/26 9:48 AM, Krishna Myneni wrote:
> On 10/24/26 17:44, marcel hendrix wrote:
>> On 10/24/2026 8:29 PM, Krishna Myneni wrote:
> ...
>>> If you post these new calculations which have problems in ver 3.1, I can test them with ver 4.1.
>>
> ...
>> >> I've found additional issues with mpfr_zeta. Here the Borwein algorithm #2 delivers results as good as Mathematica, while mpfr_zeta is far from the expected 40 decimals. >> >> : F#ZETA ( -- ) F#TOS DUP F#RND mpfr_zeta DROP ; ( tos <= zeta[tos] ) >> >> Here is the correct output of the Borwein algorithm ( IIRC you have that ) in iForth vs. the mpfr result for a couple of integer inputs: >> >> FORTH> .zeta \ input  --  Borwein  --  mpfr >>     2 1.6449340668482264364724151666460251892189e+0000 1.3116821137232264364724151666460251892189e+0000 >>     3 1.2020569031595942853997381615114499907649e+0000 1.0592003052592036603997381615114499907649e+0000 >>     4 1.0823232337111381915160036965411679027747e+0000
> I have a double precision version of the zeta function based on your code, with automated tests from your computed reference values in the kForth-x packages: forth-src/fsl/extras/zzeta.4th > > === snippet from zzeta.4th === > ... > \ 60 digit reference values computed by Marcel Hendrix > \ using MPFR/MPC version of zzeta. > > 1e 0e f/ fconstant +inf > cr > TESTING ZETA > t{  0e zeta  ->  -5.00000000000000e-01  r}t > t{  1e zeta  ->  +inf  r}t > t{  2e zeta  ->  1.6449340668482264364724151666460251892190e r}t > t{  3e zeta  ->  1.2020569031595942853997381615114499907651e r}t > t{  4e zeta  ->  1.0823232337111381915160036965411679027749e r}t > ... > === end snippet === >
MPFR has an instrinsic Riemann zeta function. I used it to compute and print the values to 60 digits: test 0 -0.50000000000000000000000000000000000000000000000000000000000E0 1 0…@Inf@000000000000000000000000000000000000000000000000000000E0 2 0.164493406684822643647241516664602518921894990120679843773556E1 3 0.120205690315959428539973816151144999076498629234049888179227E1 4 0.108232323371113819151600369654116790277475095191872690768298E1 5 0.103692775514336992633136548645703416805708091950191281197419E1 6 0.101734306198444913971451792979092052790181749003285356184241E1 7 0.100834927738192282683979754984979675959986356056523870641728E1 8 0.100407735619794433937868523850865246525896079064985002032911E1 9 0.100200839282608221441785276923241206048560585139488875654860E1 10 0.100099457512781808533714595890031901700601953156447751725779E1 Presently this only works in kForth-32. The 64-bit library interface does not include the special functions yet. I will have to add these to work under kForth-64. I am using MPFR 4.2. -- KM === begin code === include ans-words include modules include syscalls include mc include asm include strings include lib-interface include libs/gmp/libmpfr include libs/gmp/mpfr-utils \ Set precision before initializing mp vars 256 mpfr_set_default_prec mpfr_t dst mpfr_t num dst mpfr_init num mpfr_init \ Compute the zeta function of n : rzeta ( n -- a ) num swap GMP_RNDN mpfr_set_si drop dst num GMP_RNDN mpfr_zeta drop dst ; : test 11 0 do i dup 2 .r 2 spaces rzeta dst 60 mpfr. cr loop cr ; === end code ===