Re: Help stabilising mini-gmp

2016-11-25 Thread Torbjörn Granlund
Marc Glisse writes: Fixed. It was unhappy about (-13) << 2. I am a bit surprised it doesn't complain about (-13) >> 2 on the next line, we'll see if it ever becomes an issue. This must be a compiler problem. At least in C, shifting negative integers is undefined.

Re: Help stabilising mini-gmp

2016-11-25 Thread Marc Glisse
On Fri, 25 Nov 2016, Torbjörn Granlund wrote: Marc Glisse writes: Fixed. It was unhappy about (-13) << 2. I am a bit surprised it doesn't complain about (-13) >> 2 on the next line, we'll see if it ever becomes an issue. This must be a compiler problem. At least in

Re: Help stabilising mini-gmp

2016-11-25 Thread Torbjörn Granlund
Marc Glisse writes: Surprisingly, shifting negative numbers left is undefined, while shifting them right it implementation-defined. I fail to appreciate the difference between these definitions of undefinedness. I assume "undefined" means that the computer will not

Re: mpz_gcd_ext(NULL, ...)

2016-11-25 Thread Niels Möller
t...@gmplib.org (Torbjörn Granlund) writes: > I suppose it also implies a slight computation overhead > to check size + low limb for the return value. Slight enough to be reasonably for the mpz-layer, I think. One could consider doing that only when the gcd pointer is NULL, and otherwise

Re: mpz_gcd_ext(NULL, ...)

2016-11-25 Thread Niels Möller
t...@gmplib.org (Torbjörn Granlund) writes: > This sort of things probably below here: > https://gmplib.org/devel/incompatibility.html Done. I also added an entry for _mpz_newalloc, while editing that file. www-update failed, though: [nisse@shell /var/hg]$ ./www-update Checking out www.

Re: mpz_gcd_ext(NULL, ...)

2016-11-25 Thread Torbjörn Granlund
ni...@lysator.liu.se (Niels Möller) writes: www-update failed, though: [nisse@shell /var/hg]$ ./www-update Checking out www. destination directory: www updating to branch default 201 files updated, 0 files merged, 0 files removed, 0 files unresolved Compressing .html

Re: Help stabilising mini-gmp

2016-11-25 Thread Marc Glisse
On Fri, 25 Nov 2016, Marc Glisse wrote: On Mon, 21 Nov 2016, Torbjörn Granlund wrote: Marc Glisse writes: On Sun, 20 Nov 2016, Niels Möller wrote: > It would make sense to test both gmp and mini-gmp with > -fsanitize=undefined. If we are not already doing it,

Re: mpz_gcd_ext(NULL, ...)

2016-11-25 Thread Marc Glisse
On Fri, 25 Nov 2016, Niels Möller wrote: Marc Glisse writes: a user was asking if we could support calling mpz_gcd_ext with a NULL first argument (the gcd), since they are only interested in the coefficients s and t and would like to save the unnecessary allocation. I

Re: mpz_gcd_ext(NULL, ...)

2016-11-25 Thread Niels Möller
Marc Glisse writes: > a user was asking if we could support calling mpz_gcd_ext with a NULL > first argument (the gcd), since they are only interested in the > coefficients s and t and would like to save the unnecessary > allocation. I doubt it would save that much, but it

Re: mpz_gcd_ext(NULL, ...)

2016-11-25 Thread Torbjörn Granlund
ni...@lysator.liu.se (Niels Möller) writes: Sounds reasonable to me. But then I'd also consider adding a return value, returning one if the inputs were coprime (gcd == 1), otherwise zero. Would be useful for mpz_invert. That, unlike the user proposal, is a change which breaks source