gmp_printf bug?

bodrato at mail.dm.unipi.it bodrato at mail.dm.unipi.it
Thu Aug 4 17:17:40 CEST 2011


Ciao!

Il Mer, 3 Agosto 2011 11:06 pm, Torbjorn Granlund ha scritto:
> nisse at lysator.liu.se (Niels M�ller) writes:
>   After a quick look at dumpmp.c, I guess there are also significant
>   savings by having special cade to handle the case of *square* roots
>   (call to mpz_pow_ui unnecessary, and call to mpz_tdiv_q_ui can be
>   replaced by a shift).
>
> I pushed such improvements an hour ago...

They introduce a seg-fault for me. I suggest:

diff -r 5c7bc77a8301 dumbmp.c
--- a/dumbmp.c	Wed Aug 03 22:09:02 2011 +0200
+++ b/dumbmp.c	Thu Aug 04 17:13:42 2011 +0200
@@ -929,6 +929,7 @@
       return;
     }

+  mpz_init (t);
   /* One-bit initial approximation */
   mpz_init_set_ui (u, 1);
   mpz_mul_2exp (u, u, ((mpz_sizeinbase (y, 2) - 1) / z) + 1);


Regards,
Marco

-- 
http://bodrato.it/toom-cook/



More information about the gmp-devel mailing list