|
From: rtoy <rt...@us...> - 2026-05-27 17:20:43
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Maxima CAS".
The branch, rtoy-rename-preserve-direction has been created
at 129bc45c2fd82b3f7e7f4813077e64d1a56bf71d (commit)
- Log -----------------------------------------------------------------
commit 129bc45c2fd82b3f7e7f4813077e64d1a56bf71d
Author: Raymond Toy <toy...@gm...>
Date: Wed May 27 10:17:49 2026 -0700
Rename preserve-direction to *prserve-direction*
Make it clear that it's a special variable. And move the definition
from limits.lisp to globals.lisp since it's used in many files.
Update all uses of preserve-direction, of course.
Remove the declare-top for this variable since it's defined in
globals.lisp before anything else is compiled.
diff --git a/src/gamma.lisp b/src/gamma.lisp
index 582665668..79139a82b 100644
--- a/src/gamma.lisp
+++ b/src/gamma.lisp
@@ -368,8 +368,8 @@
(defprop %gamma_incomplete simplim%gamma_incomplete simplim%function)
(defun simplim%gamma_incomplete (expr var val)
- ;; Set preserve-direction to true and find the limit of each argument.
- (let* ((preserve-direction t)
+ ;; Set *preserve-direction* to true and find the limit of each argument.
+ (let* ((*preserve-direction* t)
(a (limit (cadr expr) var val 'think))
(z (limit (caddr expr) var val 'think)))
(cond
diff --git a/src/globals.lisp b/src/globals.lisp
index d4feca29d..316613cee 100644
--- a/src/globals.lisp
+++ b/src/globals.lisp
@@ -1905,3 +1905,8 @@
(defvar *integer-info* nil
"If LIMITP is non-null ASK-INTEGER conses its assumptions onto this
list.")
+
+;; Originally from limits.lisp, but used in other files.
+(defmvar *preserve-direction* ()
+ "Makes `limit' return Direction info.")
+
diff --git a/src/hstep.lisp b/src/hstep.lisp
index 533db56cb..7149620c5 100644
--- a/src/hstep.lisp
+++ b/src/hstep.lisp
@@ -20,8 +20,6 @@
(in-package :maxima)
-(declaim (special preserve-direction))
-
($put '$hstep 1 '$version)
(setf (get '%hstep 'simplim%function) 'simplim%hstep)
@@ -65,7 +63,7 @@
(defun simplim%hstep (e x pt)
"Return limit(e,x,pt), where e = hstep(X)."
- (let* ((preserve-direction t)
+ (let* ((*preserve-direction* t)
(lim (limit (cadr e) x pt 'think))
(sgn (mnqp lim 0)))
(cond
diff --git a/src/limit.lisp b/src/limit.lisp
index 80086c899..367041bab 100644
--- a/src/limit.lisp
+++ b/src/limit.lisp
@@ -52,8 +52,6 @@
(defmvar limit-using-taylor ()
"Is the current limit computation using taylor expansion?")
-(defmvar preserve-direction () "Makes `limit' return Direction info.")
-
#+nil
(unless (boundp 'integer-info) (setq integer-info ()))
@@ -265,7 +263,7 @@
(defun clean-limit-exp (exp)
(setq exp (restorelim exp))
- (if preserve-direction exp (ridofab exp)))
+ (if *preserve-direction* exp (ridofab exp)))
;; Users who want limit to map over equality (mequal) will need to do that
;; manually.
@@ -319,9 +317,9 @@
(setq *integer-info* *old-integer-info*))))
;; The optional arg allows the caller to decide on the value of
-;; preserve-direction. Default is nil, since we immediately ridofab.
+;; *preserve-direction*. Default is nil, since we immediately ridofab.
(defun both-side (exp var val &optional (preserve nil))
- (let* ((preserve-direction preserve)
+ (let* ((*preserve-direction* preserve)
(la (toplevel-$limit exp var val '$plus)) lb)
; Immediately propagate an und without trying the
; other direction
@@ -409,7 +407,7 @@
;; it doesn't.
(defun getsignl (z)
(let ((sgn))
- (setq z (let ((preserve-direction nil)) (limit-catch z var val)))
+ (setq z (let ((*preserve-direction* nil)) (limit-catch z var val)))
(cond
;; Don't call csign on ind, und, infinity, zeroa, or zerob.
;; When z is either zeroa or zerob, return 0.
@@ -651,7 +649,7 @@ ignoring dummy variables and array indices."
((not (free small '$ind)) '$ind) ;Not exactly right but not
((not (free small '$und)) '$und) ;causing trouble now.
((mapatom small) small)
- (t (let ((preserve-direction t)
+ (t (let ((*preserve-direction* t)
(new-small (subst (m^ '$inf -1) '$zeroa
(subst (m^ '$minf -1) '$zerob small))))
(simpinf new-small)))))
@@ -2177,7 +2175,7 @@ ignoring dummy variables and array indices."
;; We're looking at (neg + {zerob, 0 zeroa} %i)^el. We need to
;; do a rectform on bas and decide if the imaginary part is
;; zerob, 0, or zeroa.
- (let ((x) (y) (xlim) (ylim) (preserve-direction t))
+ (let ((x) (y) (xlim) (ylim) (*preserve-direction* t))
(setq bas (risplit bas))
(setq x (car bas)
y (cdr bas))
@@ -2211,7 +2209,7 @@ ignoring dummy variables and array indices."
(t (equal (getsignl (m1- `((mabs) ,bl))) 0))))
(defun simplimit (exp var val)
- (let ((preserve-direction t) (op nil))
+ (let ((*preserve-direction* t) (op nil))
(cond
((eq var exp) val)
@@ -2290,7 +2288,7 @@ ignoring dummy variables and array indices."
(setq e (resimplify (subst (m// 1 var) var e)))
(let ((new-val (cond ((eq val '$zeroa) '$inf)
((eq val '$zerob) '$minf))))
- (if new-val (let ((preserve-direction t))
+ (if new-val (let ((*preserve-direction* t))
(toplevel-$limit e var new-val)) (throw 'limit t))))
(defun simplimtimes (exp)
@@ -2462,12 +2460,12 @@ ignoring dummy variables and array indices."
(throw 'limit t))
;; Blend the zerob, zeroa, and sum terms. When there are both zerob
- ;; and zeroa terms, ignore them. When preserve-direction is true and
+ ;; and zeroa terms, ignore them. When *preserve-direction* is true and
;; there are zerob terms, push zerob into the sum terms. And do the same
;; for zeroa. After that, add the terms in the list sum.
- (when (and preserve-direction zerobl (null zeroal))
+ (when (and *preserve-direction* zerobl (null zeroal))
(push '$zerob sum))
- (when (and preserve-direction zeroal (null zerobl))
+ (when (and *preserve-direction* zeroal (null zerobl))
(push '$zeroa sum))
;; When indl has two or more members, we attempt to condense the
@@ -3267,7 +3265,7 @@ ignoring dummy variables and array indices."
;;; Limit(log(XXX), var, 0, val), where val is either zerob (limit from below)
;;; or zeroa (limit from above).
(defun simplimln (expr var val)
- (let ((arglim (let ((preserve-direction t)) (limit (cadr expr) var val 'think))) (dir))
+ (let ((arglim (let ((*preserve-direction* t)) (limit (cadr expr) var val 'think))) (dir))
;; When arglim is 0, try using behavior to determine if the limit is zerob or zeroa.
(when (eql arglim 0)
(setq dir (behavior expr var val))
@@ -3477,8 +3475,8 @@ ignoring dummy variables and array indices."
(ylim-z)
(dir)
(q))
- (setq xlim (let ((preserve-direction t)) (limit x v pt 'think)))
- (setq ylim (let ((preserve-direction t)) (limit y v pt 'think)))
+ (setq xlim (let ((*preserve-direction* t)) (limit x v pt 'think)))
+ (setq ylim (let ((*preserve-direction* t)) (limit y v pt 'think)))
(when (eql 0 xlim)
(setq dir (behavior x v pt))
diff --git a/src/nummod.lisp b/src/nummod.lisp
index 197009563..fdd0c4c53 100644
--- a/src/nummod.lisp
+++ b/src/nummod.lisp
@@ -26,8 +26,6 @@
(in-package :maxima)
-(declare-top (special preserve-direction))
-
(macsyma-module nummod)
;; Let's have version numbers 1,2,3,...
@@ -253,7 +251,7 @@
(defun simplim%floor (expr var val)
(let* ((arg (cadr expr))
(b (behavior arg var val))
- (arglimab (let ((preserve-direction t)) (limit arg var val 'think))) ; with $zeroa $zerob
+ (arglimab (let ((*preserve-direction* t)) (limit arg var val 'think))) ; with $zeroa $zerob
(arglim (ridofab arglimab)))
(cond
((eq arglim '$ind) (throw 'limit nil))
@@ -325,7 +323,7 @@
(defun simplim%ceiling (expr var val)
(let* ((arg (cadr expr))
(b (behavior arg var val))
- (arglimab (let ((preserve-direction t)) (limit arg var val 'think))) ; with $zeroa $zerob
+ (arglimab (let ((*preserve-direction* t)) (limit arg var val 'think))) ; with $zeroa $zerob
(arglim (ridofab arglimab)))
(cond
((eq arglim '$ind) (throw 'limit nil))
@@ -415,7 +413,7 @@
(defun simplim%round (expr var val)
(let* ((arg (cadr expr))
(b (behavior arg var val))
- (arglimab (let ((preserve-direction t)) (limit arg var val 'think))) ; with $zeroa $zerob
+ (arglimab (let ((*preserve-direction* t)) (limit arg var val 'think))) ; with $zeroa $zerob
(arglim (ridofab arglimab)))
(cond
((eq arglim '$ind) (throw 'limit nil))
diff --git a/src/sinc.lisp b/src/sinc.lisp
index f7bc79ab7..726c56ba5 100644
--- a/src/sinc.lisp
+++ b/src/sinc.lisp
@@ -76,7 +76,7 @@
(defun simplim%sinc (e x pt)
"Return limit(sinc(X),x,pt)."
- (let* ((preserve-direction t)
+ (let* ((*preserve-direction* t)
(lim (limit (cadr e) x pt 'think)))
(cond ((eq lim '$ind) '$ind) ; sinc(ind) = ind
((or (eq lim '$minf) (eq lim '$inf)) 0) ; sinc(minf) = 0 & sinc(inf) = 0
diff --git a/src/tlimit.lisp b/src/tlimit.lisp
index 1cef71321..ecab7b170 100644
--- a/src/tlimit.lisp
+++ b/src/tlimit.lisp
@@ -10,7 +10,7 @@
(in-package :maxima)
-(declare-top (special taylored *limit-assumptions* preserve-direction *getsignl-asksign-ok*))
+(declare-top (special taylored *limit-assumptions* *getsignl-asksign-ok*))
(declaim (special *limit-method-depth* *already-processed-limits*))
@@ -239,7 +239,7 @@
(new-val (liminv-new-val val)))
(cond
(new-val
- (let ((preserve-direction t))
+ (let ((*preserve-direction* t))
(taylim ee var new-val nil)))
(t
(throw 'limit t)))))
-----------------------------------------------------------------------
hooks/post-receive
--
Maxima CAS
|