On 10/24/2026 8:29 PM, Krishna Myneni wrote:
> On 10/24/26 11:13 AM, marcel hendrix wrote:
>> On 10/19/2026 1:01 PM, Krishna Myneni wrote:
[..]
>> I assume the pow and pow_... functions in the mpfr and mpc have this particular problem fixed by now.
>>
>
> If you post these new calculations which have problems in ver 3.1, I can test them with ver 4.1.
It is unlikely that my code will work for you, but here is the straight library call to push the mpfr function results on the F#stack ( iForth's arbitrary float stack). For mpfr_pow it was
\ : F#** ( -- ) F#NOS DUP F#TOS F#RND mpfr_pow DROP F#DROP ; \ tos <= tos^n, does not work for n=powerof[2]
The fix is
: F#^N ( n -- ) F#TOS DUP ROT F#RND mpfr_pow_si DROP ; \ tos <= tos^n ) this DOES work when n is 2
: F#** ( -- ) F#->N F#^N ; \ tos <= tos^n, does work for n=powerof[2]
Here is a test showing original and fixed code:
FORTH> : bad_F#** ( -- ) F#NOS DUP F#TOS F#RND mpfr_pow DROP F#DROP ; ok
FORTH> F#2.0 F#3.0 bad_F#** F#. @.I…@e-0001 ok
FORTH> F#2.0 F#3.0 F#** F#. 8.0000000000000000000000000000000000000000e+0000 ok
---( * )---
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 1.0156565710181145098753786965411679027747e+0000
5 1.0369277551433699263313654864570341680570e+0000 1.0046696906572835577705744708320341680570e+0000
6 1.0173430619844491397145179297909205279018e+0000 1.0014700461116642494800475623592799029018e+0000
7 1.0083492773819228268397975498497967595998e+0000 1.0004752616338931211207065516770367498342e+0000
8 1.0040773561979443393786852385086524652589e+0000 1.0001557875704933729187388808635580705751e+0000
9 1.0020083928260822144178527692324120604856e+0000 1.0000514456636556000450761571605095693333e+0000
10 1.0009945751278180853371459589003190170060e+0000
It is unlikely to be a problem with the interface as, e.g., the mpfr_erf function (~ same call interface) gives the expected results when compared to Mathematica.
It would help me to see the output of the mpfr and/or mpc for the above functions. However, it is starting to look like I'm wasting my time with decade old dll's.
-marcel