From 1d98e520be28cf4095fa4b3cceb43b730ad5b1da Mon Sep 17 00:00:00 2001 From: Kris Katterjohn Date: Thu, 11 Aug 2022 16:02:33 -0400 Subject: [PATCH] BOTH-SIDE: fix case where limit from below is und, from above is bounded (The opposite case where the limit from below is bounded and the limit from above is und was not problematic.) Commit df1748a8 had a bug which caused this specific case to yield ind instead of und: (%i1) limit(exp(1/x)*sin(1/x),x,0); /* correct */ (%o1) und (%i2) limit(exp(-1/x)*sin(1/x),x,0); /* incorrect */ (%o2) ind I misread the beginning of BOTH-SIDE and I thought the case where a one-sided limit yielded und was taken care of, but that was only true for one direction. There have been no tests in the test suite where the limit from one direction is und and from the other direction is something bounded. No problems with the test suite, share test suite or rtest_translator. New tests have been added to rtest_limit. --- src/limit.lisp | 4 ++++ tests/rtest_limit.mac | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/src/limit.lisp b/src/limit.lisp index b08c2dc67..82cfaad9f 100644 --- a/src/limit.lisp +++ b/src/limit.lisp @@ -299,8 +299,12 @@ (defun both-side (exp var val &optional (preserve nil)) (let* ((preserve-direction preserve) (la (toplevel-$limit exp var val '$plus)) lb) + ; Immediately propagate an und without trying the + ; other direction (when (eq la '$und) (return-from both-side '$und)) (setf lb (toplevel-$limit exp var val '$minus)) + ; Immediately propagate an und + (when (eq lb '$und) (return-from both-side '$und)) (let ((ra (ridofab la)) (rb (ridofab lb))) (cond ((eq t (meqp ra rb)) diff --git a/tests/rtest_limit.mac b/tests/rtest_limit.mac index 7d84ca036..52ead74c7 100644 --- a/tests/rtest_limit.mac +++ b/tests/rtest_limit.mac @@ -944,6 +944,12 @@ ind; limit(exp(1/x),x,0); und; +limit(exp(1/x)*sin(1/x),x,0); +und; + +limit(exp(-1/x)*sin(1/x),x,0); +und; + /* Bug #3071: limit of expressions with signum not very powerful */ limit(signum(x)^a,x,0); /* It would be better if this asked about a */ -- 2.11.4.GIT