GNU bug report logs - #66696
29.1; "A bug in the function debug."

Previous Next

Package: emacs;

Reported by: Lewis Creary <lewcreary <at> cs.com>

Date: Mon, 23 Oct 2023 05:47:01 UTC

Severity: normal

Found in version 29.1

Fixed in version 30.1

Done: Gerd Möllmann <gerd.moellmann <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


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

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Lewis Creary <lewcreary <at> cs.com>
Cc: 66696 <at> debbugs.gnu.org
Subject: bug#66696: 29.1; "A bug in the function debug."
Date: Mon, 23 Oct 2023 21:11:55 +0200
Lewis Creary <lewcreary <at> cs.com> writes:

(Please reply to all, so that your mails get to the bug tracker.)

>>> Did you get your parentheses right? The above ')' is the end of the while.
>
> I checked, and the extra parenthesis is in my bug report, but not in the code I tried to run.  I'd be interested to know if you can reproduce my
> problem in emacs lisp, with correct parentheses.
>
>    --  Lew Creary

1:    (while ((and (>= dividend 0) (not stop-sw)))
2:       (setq dividend (/ dividend 2)
3:             rmdr-list (append (list (% dividend 2)) rmdr-list) )

You write in the bug report that you start with dividend being 5, and
you expect the first element of the list to be 1, but it is 0.

When you look at line 2, dividend is divided by 2, which results in 5 /
2 = 2, because this is integer division.  In line 3, you compute the rest
of dividend (which is now 2) when divided by 2, which results in 0.

So, this looks correct.






This bug report was last modified 1 year and 202 days ago.

Previous Next


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