1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 12:21:25 -08:00

* calc/calc.el (math-bignum): Handle most-negative-fixnum.

Fixes: debbugs:17556
This commit is contained in:
Leo Liu 2014-05-24 23:14:47 +08:00
parent c94e3311ec
commit ec77463483
2 changed files with 16 additions and 3 deletions

View file

@ -1,3 +1,7 @@
2014-05-24 Leo Liu <sdl.web@gmail.com>
* calc/calc.el (math-bignum): Handle most-negative-fixnum. (Bug#17556)
2014-05-23 Stefan Monnier <monnier@iro.umontreal.ca>
* minibuffer.el (completion--sreverse): Remove.

View file

@ -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)