On 10/16/2026 9:55 PM, marcel hendrix wrote:
[..]
> But why want QD, QX or QD when the mpfr gives arbitrary precision on its own? The charm of QD is that is very small and simple, while MPFR is a beast. It could be that it is much faster than QD/QX and QD though. Maybe some tests could be done first.
As MPFR and MPC again work in iForth (inside XOPG), I did the testing.
LET sin(PI/16): GVAL x
#100000 value #iters
: TEST1 CR TIMER-RESET #iters 0 ?do LET sin(x): LOOP .ELAPSED ;
: TEST2 CR TIMER-RESET #iters 0 ?do xd=pi/16 xdsin xddrop LOOP .ELAPSED ;
: BENCH #100000 TO #iters
TEST1
TEST2 ;
FORTH> BENCH
0.826 seconds elapsed.
0.095 seconds elapsed. ok
The mpfr library is about 8 times faster than the XD-FP Forth library based on the ideas of Julian V. Noble, Seppo Linnainmaa, and David H. Bailey. As my mpfr .so is from 2012, I guess it will be even more dramatic with a modern binary. Still, a few xd-fp words might find a
permanent place in the iForth kernel.
-marcel