emacs-bug-tracker
[Top][All Lists]
Advanced

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

[debbugs-tracker] bug#17556: closed (24.4.50; fix math-bignum)


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#17556: closed (24.4.50; fix math-bignum)
Date: Sat, 24 May 2014 15:22:02 +0000

Your message dated Sat, 24 May 2014 23:19:50 +0800
with message-id <address@hidden>
and subject line Re: bug#17556: 24.4.50; fix math-bignum
has caused the debbugs.gnu.org bug report #17556,
regarding 24.4.50; fix math-bignum
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
17556: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17556
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 24.4.50; fix math-bignum Date: Fri, 23 May 2014 12:46:05 +0800
Due to integer overflow (math-bignum most-negative-fixnum) is incorrect.
Any objection if I fix it like in this patch:

=== modified file 'lisp/calc/calc.el'
--- lisp/calc/calc.el   2014-01-01 07:43:34 +0000
+++ lisp/calc/calc.el   2014-05-23 04:42:18 +0000
@@ -2773,9 +2773,15 @@
 
 ;; 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: (- most-negative-fixnum) is most-negative-fixnum
+    (math-sub (cons 'bigneg (math-bignum-big (- (1+ a))))
+             1))
+   (t
+    (cons 'bigneg (math-bignum-big (- a))))))
 
 (defun math-bignum-big (a)   ; [L s]
   (if (= a 0)



--- End Message ---
--- Begin Message --- Subject: Re: bug#17556: 24.4.50; fix math-bignum Date: Sat, 24 May 2014 23:19:50 +0800 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (CentOS 6.5)
Fixed in 24.5


--- End Message ---

reply via email to

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