emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-24 r117317: Backport fix for http://debbugs.gnu.org/


From: Leo Liu
Subject: [Emacs-diffs] emacs-24 r117317: Backport fix for http://debbugs.gnu.org/17556 from trunk
Date: Fri, 27 Jun 2014 04:11:13 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117317
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/17556
committer: Leo Liu <address@hidden>
branch nick: emacs-24
timestamp: Fri 2014-06-27 12:10:04 +0800
message:
  Backport fix for http://debbugs.gnu.org/17556 from trunk
  
  * lisp/calc/calc.el (math-bignum): Handle most-negative-fixnum.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/calc/calc.el              calc.el-20091113204419-o5vbwnq5f7feedwu-2306
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-06-27 00:48:34 +0000
+++ b/lisp/ChangeLog    2014-06-27 04:10:04 +0000
@@ -1,3 +1,7 @@
+2014-06-27  Leo Liu  <address@hidden>
+
+       * calc/calc.el (math-bignum): Handle most-negative-fixnum.  (Bug#17556)
+
 2014-06-27  Glenn Morris  <address@hidden>
 
        * net/eww.el (eww-mode) <eww-current-title>: Make local.  (Bug#17860)

=== modified file 'lisp/calc/calc.el'
--- a/lisp/calc/calc.el 2014-01-01 07:43:34 +0000
+++ b/lisp/calc/calc.el 2014-06-27 04:10:04 +0000
@@ -2773,9 +2773,18 @@
 
 ;; 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)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]