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. >
...
> > FORTH> LET (2,3):  F#** .print  @.I…@e-0003 ok > FORTH> LET (2,2):  F#** .print  @.I…@e-0001 ok > FORTH> LET (3,2):  F#** .print
I'm currently using MPFR ver 4.2.1. Both mpfr_pow and mpfr_pow_ui appear to be working: 2^3 r1 = 0.200000000000000000000000000000000000000000000000000000000000E1 r2 = 0.300000000000000000000000000000000000000000000000000000000000E1 Using mpfr_pow r1^r2 = 0.800000000000000000000000000000000000000000000000000000000000E1 Using mpfr_pow_ui r1^3 = 0.800000000000000000000000000000000000000000000000000000000000E1 2^2 r1 = 0.200000000000000000000000000000000000000000000000000000000000E1 r2 = 0.200000000000000000000000000000000000000000000000000000000000E1 Using mpfr_pow r1^r2 = 0.400000000000000000000000000000000000000000000000000000000000E1 Using mpfr_pow_ui r1^2 = 0.400000000000000000000000000000000000000000000000000000000000E1 ok -- 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 DECIMAL 256 mpfr_set_default_prec \ provides 77 sig. decimal digits mpfr_t r1 mpfr_t r2 mpfr_t dst r1 mpfr_init r2 mpfr_init dst mpfr_init cr cr .( 2^3) cr r1 2 GMP_RNDN mpfr_set_ui drop r2 3 GMP_RNDN mpfr_set_ui drop .( r1 = ) r1 60 mpfr. cr .( r2 = ) r2 60 mpfr. cr cr .( Using mpfr_pow) cr dst r1 r2 GMP_RNDN mpfr_pow drop .( r1^r2 = ) dst 60 mpfr. cr cr .( Using mpfr_pow_ui) cr dst r1 3 GMP_RNDN mpfr_pow_ui drop .( r1^3 = ) dst 60 mpfr. cr cr .( 2^2) cr r2 2 GMP_RNDN mpfr_set_ui drop .( r1 = ) r1 60 mpfr. cr .( r2 = ) r2 60 mpfr. cr cr .( Using mpfr_pow) cr dst r1 r2 GMP_RNDN mpfr_pow drop .( r1^r2 = ) dst 60 mpfr. cr cr .( Using mpfr_pow_ui) cr dst r1 2 GMP_RNDN mpfr_pow_ui drop .( r1^2 = ) dst 60 mpfr. cr === end code ===