mpz_t n;
int l;
mpz_init(n);
mpz_set_ui(n,1);
mpz_add_ui(n,n,1);
fprintf(stdout,"n = ");
l = mpz_out_str(stdout,10,n); // stdout stay unchanged here
fprintf (stdout,"; (%d)\n",l);
l = gmp_printf("n = %Zd", n) ; // stdout stay unchanged here
fprintf (stdout,"; (%d)\n",l);
char buf[1024];
l = gmp_sprintf(buf,"%Zd",n);
printf ("n = %s; (%d)\n",buf,l);
printf("%s\n",gmp_version);
and it print
n = ; (1)
; (5)
n = 2; (1)
6.2.1
The same code compiled by gcc prints OK:
n = 2; (1)
n = 2; (5)
n = 2; (1)
6.2.1
I assume it because it use different libraries
xeus 3.1.4 h06414e2_0 conda-forge, xeus-cling 0.15.3 he80cb83_2 conda-forge:
/home/username/miniforge3/envs/cling/include/gmp.h /home/username/miniforge3/envs/cling/lib/libgmp.so
gcc (GCC) 13.2.1 20231205 (Red Hat 13.2.1-6): /usr/include/gmp.h /lib64/libgmp.so
but it don't solve the problem
I run next con in xeus-cling:
and it print
The same code compiled by gcc prints OK:
I assume it because it use different libraries
xeus 3.1.4 h06414e2_0 conda-forge, xeus-cling 0.15.3 he80cb83_2 conda-forge:
/home/username/miniforge3/envs/cling/include/gmp.h /home/username/miniforge3/envs/cling/lib/libgmp.so
gcc (GCC) 13.2.1 20231205 (Red Hat 13.2.1-6): /usr/include/gmp.h /lib64/libgmp.so
but it don't solve the problem