diff options
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/calc/calc.el | 15 |
2 files changed, 16 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7c2b1ec5ad6..b786027f76d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2014-05-24 Leo Liu <sdl.web@gmail.com> | ||
| 2 | |||
| 3 | * calc/calc.el (math-bignum): Handle most-negative-fixnum. (Bug#17556) | ||
| 4 | |||
| 1 | 2014-05-23 Stefan Monnier <monnier@iro.umontreal.ca> | 5 | 2014-05-23 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 6 | ||
| 3 | * minibuffer.el (completion--sreverse): Remove. | 7 | * minibuffer.el (completion--sreverse): Remove. |
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) |