aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Liu2014-06-27 12:10:04 +0800
committerLeo Liu2014-06-27 12:10:04 +0800
commit708dc66d7b8dd5bd4f66558cd6a61502b6b68b43 (patch)
treea85566266437747dbdebfcb9819171ac85938c01
parent340d54a195785ff94de2b274fd71a75a71908af2 (diff)
downloademacs-708dc66d7b8dd5bd4f66558cd6a61502b6b68b43.tar.gz
emacs-708dc66d7b8dd5bd4f66558cd6a61502b6b68b43.zip
Backport fix for http://debbugs.gnu.org/17556 from trunk
* lisp/calc/calc.el (math-bignum): Handle most-negative-fixnum.
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/calc/calc.el15
2 files changed, 16 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a2cb2845bc7..dcbb027e94f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
12014-06-27 Leo Liu <sdl.web@gmail.com>
2
3 * calc/calc.el (math-bignum): Handle most-negative-fixnum. (Bug#17556)
4
12014-06-27 Glenn Morris <rgm@gnu.org> 52014-06-27 Glenn Morris <rgm@gnu.org>
2 6
3 * net/eww.el (eww-mode) <eww-current-title>: Make local. (Bug#17860) 7 * net/eww.el (eww-mode) <eww-current-title>: Make local. (Bug#17860)
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el
index ba1c7de9967..04d852e5cb3 100644
--- a/lisp/calc/calc.el
+++ b/lisp/calc/calc.el
@@ -2773,9 +2773,18 @@ largest Emacs integer.")
2773 2773
2774;; Coerce integer A to be a bignum. [B S] 2774;; Coerce integer A to be a bignum. [B S]
2775(defun math-bignum (a) 2775(defun math-bignum (a)
2776 (if (>= a 0) 2776 (cond
2777 (cons 'bigpos (math-bignum-big a)) 2777 ((>= a 0)
2778 (cons 'bigneg (math-bignum-big (- a))))) 2778 (cons 'bigpos (math-bignum-big a)))
2779 ((= a most-negative-fixnum)
2780 ;; Note: cannot get the negation directly because
2781 ;; (- most-negative-fixnum) is most-negative-fixnum.
2782 ;;
2783 ;; most-negative-fixnum := -most-positive-fixnum - 1
2784 (math-sub (cons 'bigneg (math-bignum-big most-positive-fixnum))
2785 1))
2786 (t
2787 (cons 'bigneg (math-bignum-big (- a))))))
2779 2788
2780(defun math-bignum-big (a) ; [L s] 2789(defun math-bignum-big (a) ; [L s]
2781 (if (= a 0) 2790 (if (= a 0)