Am Wed, Nov 30, 2022 at 03:34:39PM +0100 schrieb Paul Zimmermann:
> ok &= (re == -262537412640768000L && im == 1);
> I suspect the 2nd line. Maybe we should write -262537412640768000LL?
Indeed this line looks like the culprit. I will replace it by an mpz value
for good measure, and also add a few printf in between.
On Windows, if 're' and 'im' need to be a 64-bit integer types then they'll need to be either 'long long int' or 'int64_t' or __Int64, and they'll need to be assigned their values using mpfr_get_sj, not mpfr_get_si.
Also, as Paul has already suggested, '-262537412640768000L' needs to be rewritten as ' -262537412640768000LL'.
This patch to tata.c allows teta.exe to PASS for me on both 32-bit and 64-bit Windows:
$ diff -wu teta.c_orig teta.c
--- teta.c_orig 2022-04-22 23:47:23.000000000 +1000
+++ teta.c 2022-12-01 14:57:24.294403900 +1100
@@ -20,6 +20,7 @@
#include <math.h>
#include "mpc-impl.h"
+#include <inttypes.h>
static void
mpcb_j_err (mpcb_ptr j, mpc_srcptr z, unsigned long int err_re,
@@ -66,7 +67,7 @@
mpc_t z, eta;
mpcb_t j;
mpfr_t fuzz;
- long int re, im;
+ int64_t re, im;
int ok;
mpc_init2 (z, p);
@@ -97,9 +98,9 @@
mpfr_add_ui (mpc_imagref (j->c), mpc_imagref (j->c), 1, MPFR_RNDN);
ok = mpcb_can_round (j, 291, 234, MPC_RNDNN);
mpcb_round (z, j, MPC_RNDNN);
- re = mpfr_get_si (mpc_realref (z), MPFR_RNDN);
- im = mpfr_get_si (mpc_imagref (z), MPFR_RNDN);
- ok &= (re == -262537412640768000L && im == 1);
+ re = mpfr_get_sj (mpc_realref (z), MPFR_RNDN);
+ im = mpfr_get_sj (mpc_imagref (z), MPFR_RNDN);
+ ok &= (re == -262537412640768000LL && im == 1);
/* Check whether mpc_eta_fund (I) avoids an infinite loop. */
mpc_set_ui_ui (z, 0, 1, MPC_RNDNN);
@@ -112,8 +113,8 @@
mpfr_add_ui (mpc_imagref (j->c), mpc_imagref (j->c), 1, MPFR_RNDN);
ok &= mpcb_can_round (j, 292, 282, MPC_RNDNN);
mpcb_round (z, j, MPC_RNDNN);
- re = mpfr_get_si (mpc_realref (z), MPFR_RNDN);
- im = mpfr_get_si (mpc_imagref (z), MPFR_RNDN);
+ re = mpfr_get_sj (mpc_realref (z), MPFR_RNDN);
+ im = mpfr_get_sj (mpc_imagref (z), MPFR_RNDN);
ok &= (re == 1728 && im == 1);
mpc_clear (eta);
It seems odd that the same issue does not arise on 32-bit Linux.
Cheers,
Rob