remove extra division in mpq/aors.c

Marc Glisse marc.glisse at
Sun Feb 20 19:55:14 CET 2011

On Sun, 20 Feb 2011, Torbjorn Granlund wrote:

> OK, I'll apply that patch instead.  Could you please make a change log
> for it?

2011-02-20  Marc Glisse  <marc.glisse at>

 	* mpq/aors.c: Remove redundant division

> BTW, did you make sure the temps will be suffient?

I hope I did, but a second look couldn't hurt.

> I wonder if 4 distinct temp areas (gcd, tmp1, tmp2, t) are really
> necessary.

At least I didn't increase that number ;-)

We could certainly merge the first 3 into one area with gcd, tmp1 and tmp2 
pointing to different offsets into it. If I remember correctly this is 
something that could be done in many places in gmp.

With the first patch, it would be possible to completely remove t by 
reusing the numerator of the result, but it may needlessly increase some 
permanent storage.

> I have attached a patch to modernise a related function.  Does it look
> correct to you?

I am sorry but I am not familiar at all with the large number of division 
functions. I can try to have a look next week.

Marc Glisse

More information about the gmp-discuss mailing list