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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 17556 in the body.
You can then email your comments to 17556 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to jay.p.belanger <at> gmail.com, bug-gnu-emacs <at> gnu.org:
bug#17556; Package emacs. (Fri, 23 May 2014 04:48:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo Liu <sdl.web <at> gmail.com>:
New bug report received and forwarded. Copy sent to jay.p.belanger <at> gmail.com, bug-gnu-emacs <at> gnu.org. (Fri, 23 May 2014 04:48:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

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)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17556; Package emacs. (Fri, 23 May 2014 07:34:02 GMT) Full text and rfc822 format available.

Message #8 received at 17556 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: 17556 <at> debbugs.gnu.org
Subject: Re: bug#17556: 24.4.50; fix math-bignum
Date: Fri, 23 May 2014 09:33:36 +0200
Leo Liu <sdl.web <at> gmail.com> writes:

> +    (math-sub (cons 'bigneg (math-bignum-big (- (1+ a))))

aka                                             (- 1 a)

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17556; Package emacs. (Fri, 23 May 2014 08:24:02 GMT) Full text and rfc822 format available.

Message #11 received at 17556 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Andreas Schwab <schwab <at> linux-m68k.org>, Leo Liu <sdl.web <at> gmail.com>
Cc: 17556 <at> debbugs.gnu.org
Subject: Re: bug#17556: 24.4.50; fix math-bignum
Date: Fri, 23 May 2014 10:23:26 +0200
>> +    (math-sub (cons 'bigneg (math-bignum-big (- (1+ a))))
>
> aka                                             (- 1 a)

Hmmm...

martin






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17556; Package emacs. (Fri, 23 May 2014 09:46:02 GMT) Full text and rfc822 format available.

Message #14 received at 17556 <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: 17556 <at> debbugs.gnu.org
Subject: Re: bug#17556: 24.4.50; fix math-bignum
Date: Fri, 23 May 2014 17:44:24 +0800
On 2014-05-23 09:33 +0200, Andreas Schwab wrote:
> aka                                             (- 1 a)

aka most-positive-fixnum ;)

Leo




Reply sent to Leo Liu <sdl.web <at> gmail.com>:
You have taken responsibility. (Sat, 24 May 2014 15:22:02 GMT) Full text and rfc822 format available.

Notification sent to Leo Liu <sdl.web <at> gmail.com>:
bug acknowledged by developer. (Sat, 24 May 2014 15:22:03 GMT) Full text and rfc822 format available.

Message #19 received at 17556-done <at> debbugs.gnu.org (full text, mbox):

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




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 22 Jun 2014 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 161 days ago.

Previous Next


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