summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/comp-cstr.el26
1 files changed, 14 insertions, 12 deletions
diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el
index ad956dabd8a..9eaf38067f6 100644
--- a/lisp/emacs-lisp/comp-cstr.el
+++ b/lisp/emacs-lisp/comp-cstr.el
@@ -454,18 +454,20 @@ Return them as multiple value."
(declare (debug (range-body))
(indent defun))
`(with-comp-cstr-accessors
- (when-let ((r1 (range ,src1))
- (r2 (range ,src2)))
- (let* ((l1 (comp-cstr-smallest-in-range r1))
- (l2 (comp-cstr-smallest-in-range r2))
- (h1 (comp-cstr-greatest-in-range r1))
- (h2 (comp-cstr-greatest-in-range r2)))
- (setf (typeset ,dst) (when (cl-some (lambda (x)
- (comp-subtype-p 'float x))
- (append (typeset src1)
- (typeset src2)))
- '(float))
- (range ,dst) ,@range-body)))))
+ (if (or (neg src1) (neg src2))
+ (setf (typeset ,dst) '(number))
+ (when-let ((r1 (range ,src1))
+ (r2 (range ,src2)))
+ (let* ((l1 (comp-cstr-smallest-in-range r1))
+ (l2 (comp-cstr-smallest-in-range r2))
+ (h1 (comp-cstr-greatest-in-range r1))
+ (h2 (comp-cstr-greatest-in-range r2)))
+ (setf (typeset ,dst) (when (cl-some (lambda (x)
+ (comp-subtype-p 'float x))
+ (append (typeset src1)
+ (typeset src2)))
+ '(float))
+ (range ,dst) ,@range-body))))))
(defun comp-cstr-add-2 (dst src1 src2)
"Sum SRC1 and SRC2 into DST."