speed of unbalanced division

2013-02-04 Thread Zimmermann Paul
Hi, on January 25 I reported efficiency issues with unbalanced multiplication. Here I report similar issues with unbalanced division. Consider the program below. I get on a 2Ghz Intel Xeon E7540 with GMP 5.1.0: barbecue% ./bug2 201 101 mpz_tdiv_q(201,101) took 2244ms

Re: Extending the mpn interface

2013-02-04 Thread Niels Möller
ni...@lysator.liu.se (Niels Möller) writes: Here's a sketch (totally untested, not even compiled), supporting the operations I have seen a need for. As usual, good naming is the difficult part ;-) Here's a new iteration, which has actually had some testing. I think I'll be using these

Re: Public mpz_ptr and mpz_srcptr

2013-02-04 Thread Torbjorn Granlund
ni...@lysator.liu.se (Niels Möller) writes: gmp.h includes the following: /* Types for function declarations in gmp files. */ /* ??? Should not pollute user name space with these ??? */ typedef const __mpz_struct *mpz_srcptr; typedef __mpz_struct *mpz_ptr; I'm afraid

Re: Public mpz_ptr and mpz_srcptr

2013-02-04 Thread Vincent Lefevre
On 2013-02-04 14:21:54 +0100, Vincent Lefevre wrote: On 2013-02-04 13:57:16 +0100, Torbjorn Granlund wrote: I chose to not provide mpz_ptr since I think it would be prone to errors. I expect code like this to be created: mpz_ptr foo (mpz_t a, mpz_t b) { mpz_t c; mpz_init

Re: Public mpz_ptr and mpz_srcptr

2013-02-04 Thread Vincent Lefevre
On 2013-02-04 14:26:38 +0100, Torbjorn Granlund wrote: Vincent Lefevre vinc...@vinc17.net writes: On 2013-02-04 13:57:16 +0100, Torbjorn Granlund wrote: I chose to not provide mpz_ptr since I think it would be prone to errors. I expect code like this to be created: mpz_ptr

Re: Public mpz_ptr and mpz_srcptr

2013-02-04 Thread Niels Möller
Torbjorn Granlund t...@gmplib.org writes: I don't think it is self-evident that mpz_t is special. That's exactly why array typedefs should be avoided in general. When calling a function, it *looks* like you are passing a variable by value, but in fact it will automatically be passed by