GNU bug report logs - #17556
24.4.50; fix math-bignum

Previous Next

Package: emacs;

Reported by: Leo Liu <sdl.web <at> gmail.com>

Date: Fri, 23 May 2014 04:48:01 UTC

Severity: normal

Found in version 24.4.50

Done: Leo Liu <sdl.web <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Leo Liu <sdl.web <at> gmail.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#17556: closed (24.4.50; fix math-bignum)
Date: Sat, 24 May 2014 15:22:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sat, 24 May 2014 23:19:50 +0800
with message-id <m3egzj2oh5.fsf <at> gmail.com>
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
help-debbugs <at> gnu.org.)


-- 
17556: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17556
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Leo Liu <sdl.web <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
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)


[Message part 3 (message/rfc822, inline)]
From: Leo Liu <sdl.web <at> gmail.com>
To: 17556-done <at> debbugs.gnu.org
Subject: Re: bug#17556: 24.4.50; fix math-bignum
Date: Sat, 24 May 2014 23:19:50 +0800
Fixed in 24.5


This bug report was last modified 11 years and 54 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.