[GiNaC-list] Bug in numer_denom?

Alexei Sheplyakov alexei.sheplyakov at gmail.com
Thu Nov 18 16:55:14 CET 2010


Hello,

On Wed, Nov 17, 2010 at 01:06:39AM +0100, Richard B. Kreckel wrote:
 
> On 11/10/2010 04:22 PM, Ernst Moritz Hahn wrote:
> >I think there is a problem with the numer_denom function with large
> >polynomial fractions. I added "bug.txt" to the attachment, which is an
> >input file for ginsh. Using the version of GiNaC shipped with current
> >stable Ubuntu,

Could you please specify the exact version of GiNaC you use? (I have no
idea what is shipped with Ubuntu, sorry).

> >I get the result "out-installed". Here, "/" is contained
> >in numerator and denominator, which should not be the case, if I
> >understood the functionality of numer_denom right.

As far as I can see the problem is caused by GCD miscalculation bug.
It has been fixed ~ 6 months ago (by commit edf1ae46a, see
http://www.ginac.de/ginac.git?p=ginac.git;a=commit;h=edf1ae46a).

> >Using git version of GiNaC, I get "out-git.txt". Here, braces are
> >used in numerator and
> >denominator, which also seems strange to me.

Braces are OK. numer_denom returns a list consisting of numerator and
denominator, and GiNaC prints lists as { element0, element1, ... elementN }.

> Is anything wrong? I don't know. Please, try to reduce example
> output you send to the mailing list as much as possible.

I think reducing this particular example is a bit non-trivial, and
is not a user's job.

> On the other hand, the result computed by the installed version
> leaves room for improvement, as it treats numerator and denominator
> as polynomials over the rationals, as opposed to polynomials over
> the integers.

I don't think so. As far as I understand it's a result of GCD
miscalculation: numer_denom thinks A and B are relatively prime
and returns them as is.

> This change in behavior seems to be a consequence of Alexei
> Sheplyakov's patch edf1ae46a926d0a718063c149b78c1b9a7ec2043. It
> first featured in release 1.5.8.

This confirms my hypothesis, but I need to check it more carefully
(there might be some more bugs in GCD code).

Best regards,
	Alexei



More information about the GiNaC-list mailing list