sign-prep strangeness



I am back from holiday and I have recognized that there is a problem
with SIGN-PREP.

I had a look at the code and I have found two different problems.

First, we should not enter the code in sign-prep when in a limit mode:

(defun sign-prep (x)
  (if (and limitp (not *complexsign*))
      ;; Do not enter this code when in complex mode.
      (destructuring-let (((rpart . ipart) (trisplit x)))
      ...

The reported examples will work again:

(%i1) block ([?limitp : true], sign (foo (x)));
(%o1) pnz

(%i4) integrate(sqrt(2*m*(E[n]-U(x))),x,-x[0],x[0])=(n-1/2)*%pi*hbar;
(%o4) sqrt(2)*'integrate(sqrt(m*(E[n]-U(x))),x,-x[0],x[0]) = %
pi*hbar*(n-1/2)

Another example which now gives a stack overflow is:

(%i5) limit(x*'integrate(f(t),t,0,x),x,inf);
(%o5) infinity

Second, the routine risplit no longer returns a real value for a
subscripted variable. We have do add a check for a subscripted variable
to the routine ripsplit

...
(($subvarp l)
 ;; return a real answer for subscripted variable
 (cons l 0))
(t
 (cons (list '(%realpart) l)
       (list '(%imagpart) l))))))

With this change the following example will work again:

(%i6)  integrate(f(x),x,x[0],x[1]);
(%o6) 'integrate(f(x),x,x[0],x[1])

The testsuite and the share_testsuite have no problems with this
changes. Unfortunately, the testsuite has not shown the problems
earlier.

Dieter Kaiser