Maxima's rat package and "quotient is not exact"



>>>>> "Andrej" == Andrej Vodopivec <andrej.vodopivec at gmail.com> writes:

    Andrej> Hi,

    Andrej> it looks like rational package uses f<, f+, ... macros on coefficients
    Andrej> of polynomials in a lot of places. This causes problems when the
    Andrej> coefficients are bignums. I think this could be a cause of at least
    Andrej> some of the bugs. For example

    Andrej> (%i1) diff(integrate(1/(x^5+1), x), x)$
    Andrej> (%i2) :lisp (trace prem);
    Andrej> (PREM)
    Andrej> (%i2) ratsimp(%o1);

[snip]

At one point, I get this:

  0: (PREM
      (#:X3332 7 2 6 (#:|sqrt(5)3331| 1 1 0 -1) 5 2 2 2 1
       (#:|sqrt(5)3331| 1 1 0 -1) 0 2)
      (#:X3332 5 (#:|sqrt(5)3331| 1 3 0 15) 2 20 1 (#:|sqrt(5)3331| 1 10 0 -10)
       0 (#:|sqrt(5)3331| 1 3 0 35)))
  0: PREM returned
       (#:X3332 4 (#:|sqrt(5)3331| 1 -3600 0 -10800) 3
        (#:|sqrt(5)3331| 1 -7200 0 -7200) 2 (#:|sqrt(5)3331| 1 -7200 0 -28800)
        1 (#:|sqrt(5)3331| 1 -7200 0 -7200) 0
        (#:|sqrt(5)3331| 1 -3600 0 -10800))

I think this is computing the remainder between

    2*x^7+(sqrt(5)-1)*x^6+2*x^5+2*x^2+(sqrt(5)-1)*x+2

and

   (3*sqrt(5)+15)*x^5+20*x^2+(10*sqrt(5)-10)*x+(3*sqrt(5)-35)

and prem says the remainder is 

  (-3600*sqrt(5)-10800)*x^4 + (-7200*sqrt(5)-7200)*x^3
    + (-7200*sqrt(5)-28800)*x^2 + (-7200*sqrt(5)-7200)*x
    + (-3600*sqrt(5)-10800)

Compare this result against divide(), which says the remainder is

-(40*x^4+(40*sqrt(5)-40)*x^3-20*sqrt(5)*x^2+(30-30*sqrt(5))*x-100)
	 /(3*sqrt(5)+15)

I don't see how any scaling of this would match the result returned by
prem.  But perhaps I'm missing something.

Ray