iForth uses the mpfr 3.1.0 release, and possibly other Forths do too. I
have found that the mpfr_pow(rop, op1,op2,roundingmode) function does
not work for at least *some* values of op1 (0 and 1 works) that are a
power of 2 (0 and 1 work). The source hints at this, the documentation
does not.
FORTH> LET (2,3):-a F#** .print-a @.Inf@e-0003 okI'm currently using MPFR ver 4.2.1.
FORTH> LET (2,2):-a F#** .print-a @.Inf@e-0001 ok
FORTH> LET (3,2):-a F#** .print
On 10/18/26 11:42 AM, marcel hendrix wrote:[..]
iForth uses the mpfr 3.1.0 release, and possibly other Forths do too....
I have found that the mpfr_pow(rop, op1,op2,roundingmode) function
does not work for at least *some* values of op1 (0 and 1 works) that
are a power of 2 (0 and 1 work). The source hints at this, the
documentation does not.
I'm currently using MPFR ver 4.2.1.
FORTH> LET (2,3):-a F#** .print-a @.Inf@e-0003 ok
FORTH> LET (2,2):-a F#** .print-a @.Inf@e-0001 ok
FORTH> LET (3,2):-a F#** .print
Both mpfr_pow and mpfr_pow_ui appear to be working:
On 10/19/2026 1:01 PM, Krishna Myneni wrote:
On 10/18/26 11:42 AM, marcel hendrix wrote:[..]
iForth uses the mpfr 3.1.0 release, and possibly other Forths do too....
I have found that the mpfr_pow(rop, op1,op2,roundingmode) function
does not work for at least *some* values of op1 (0 and 1 works) that
are a power of 2 (0 and 1 work). The source hints at this, the
documentation does not.
I'm currently using MPFR ver 4.2.1.
FORTH> LET (2,3):-a F#** .print-a @.Inf@e-0003 ok
FORTH> LET (2,2):-a F#** .print-a @.Inf@e-0001 ok
FORTH> LET (3,2):-a F#** .print
Both mpfr_pow and mpfr_pow_ui appear to be working:
Thanks! I'll upgrade to gmp 5.0 and mpfr 4.2.2 shortly.
Meanwhile, I found that the present mpfr_pow_ui works correctly. As I
don't need to compute 2.5362^2.1 that often, I'll get by :--)
Meanwhile, I found that the present mpfr_pow_ui works correctly. As I
don't need to compute 2.5362^2.1 that often, I'll get by :--)
It would be truly bad if mpfr_pow_ui didn't work! If you know where I
can get the Win32 DLL for MPFR 4.2, please let me know. I would like to
make it available with kForth-Win32.
On 10/18/26 11:42 AM, marcel hendrix wrote:[..]
iForth uses the mpfr 3.1.0 release, and possibly other Forths do too.
I have found that the mpfr_pow(rop, op1,op2,roundingmode) function
does not work for at least *some* values of op1 (0 and 1 works) that
are a power of 2 (0 and 1 work). The source hints at this, the
documentation does not.
On 10/19/2026 1:01 PM, Krishna Myneni wrote:
On 10/18/26 11:42 AM, marcel hendrix wrote:[..]
iForth uses the mpfr 3.1.0 release, and possibly other Forths do too.
I have found that the mpfr_pow(rop, op1,op2,roundingmode) function
does not work for at least *some* values of op1 (0 and 1 works) that
are a power of 2 (0 and 1 work). The source hints at this, the
documentation does not.
I finished debugging the mpc (arbitrary complex) libraries (same
timestamps as mpfr). The mpc_pow function had the same problem as
mpfr_pow. It is a bit worse, as mpc_pow_si now also has this problem (mpfr_pow_si is ok). I 'fixed' the problem by adding 1e-250 to the
function argument in case it is exactly 2.
There were other problems too, but they didn't affect the iForth
ferrari, zgamma and zeta examples.
I assume the pow and pow_... functions in the mpfr and mpc have this particular problem fixed by now.
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.
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 algorithmI have a double precision version of the zeta function based on your
#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-a ---a Borwein-a ---a mpfr
-a-a 2 1.6449340668482264364724151666460251892189e+0000 1.3116821137232264364724151666460251892189e+0000
-a-a 3 1.2020569031595942853997381615114499907649e+0000 1.0592003052592036603997381615114499907649e+0000
-a-a 4 1.0823232337111381915160036965411679027747e+0000
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 have a double precision version of the zeta function based on your
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-a ---a Borwein-a ---a mpfr
-a-a-a 2 1.6449340668482264364724151666460251892189e+0000
1.3116821137232264364724151666460251892189e+0000
-a-a-a 3 1.2020569031595942853997381615114499907649e+0000
1.0592003052592036603997381615114499907649e+0000
-a-a-a 4 1.0823232337111381915160036965411679027747e+0000
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{-a 0e zeta-a ->-a -5.00000000000000e-01-a r}t
t{-a 1e zeta-a ->-a +inf-a r}t
t{-a 2e zeta-a ->-a 1.6449340668482264364724151666460251892190e r}t
t{-a 3e zeta-a ->-a 1.2020569031595942853997381615114499907651e r}t
t{-a 4e zeta-a ->-a 1.0823232337111381915160036965411679027749e r}t
...
=== end snippet ===
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.
FORTH> .zeta \ input-a ---a Borwein-a ---a mpfr
-a-a-a 2 1.6449340668482264364724151666460251892189e+0000
1.3116821137232264364724151666460251892189e+0000
-a-a-a 3 1.2020569031595942853997381615114499907649e+0000
1.0592003052592036603997381615114499907649e+0000
-a-a-a 4 1.0823232337111381915160036965411679027747e+0000
MPFR has an instrinsic Riemann zeta function. I used it to compute and
print the values to 60 digits:
test
-a2-a 0.164493406684822643647241516664602518921894990120679843773556E1
-a3-a 0.120205690315959428539973816151144999076498629234049888179227E1
-a4-a 0.108232323371113819151600369654116790277475095191872690768298E1
Presently this only works in kForth-32. The 64-bit library interfaceThank you! This clearly shows that MPFR 4.2 matches Borwein's code and Mathematica, where MPFR 3.0.1 does not. I should upgrade, as this makes
does not include the special functions yet. I will have to add these to
work under kForth-64. I am using MPFR 4.2.
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 76 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 53:44:55 |
| Calls: | 1,265 |
| Calls today: | 1 |
| Files: | 1,362 |
| D/L today: |
3 files (2,684K bytes) |
| Messages: | 285,448 |