Commit 708dc66d authored by Leo Liu's avatar Leo Liu

Backport fix for http://debbugs.gnu.org/17556 from trunk

* lisp/calc/calc.el (math-bignum): Handle most-negative-fixnum.
parent 340d54a1
2014-06-27 Leo Liu <sdl.web@gmail.com>
* calc/calc.el (math-bignum): Handle most-negative-fixnum. (Bug#17556)
2014-06-27 Glenn Morris <rgm@gnu.org>
* net/eww.el (eww-mode) <eww-current-title>: Make local. (Bug#17860)
......
......@@ -2773,9 +2773,18 @@ largest Emacs integer.")
;; Coerce integer A to be a bignum. [B S]
(defun math-bignum (a)
(if (>= a 0)
(cons 'bigpos (math-bignum-big a))
(cons 'bigneg (math-bignum-big (- a)))))
(cond
((>= a 0)
(cons 'bigpos (math-bignum-big a)))
((= a most-negative-fixnum)
;; Note: cannot get the negation directly because
;; (- most-negative-fixnum) is most-negative-fixnum.
;;
;; most-negative-fixnum := -most-positive-fixnum - 1
(math-sub (cons 'bigneg (math-bignum-big most-positive-fixnum))
1))
(t
(cons 'bigneg (math-bignum-big (- a))))))
(defun math-bignum-big (a) ; [L s]
(if (= a 0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment