unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Gerd Möllmann" <gerd.moellmann@gmail.com>
To: Lewis Creary <lewcreary@cs.com>
Cc: 66696@debbugs.gnu.org
Subject: bug#66696: 29.1; "A bug in the function debug."
Date: Mon, 23 Oct 2023 21:11:55 +0200	[thread overview]
Message-ID: <m21qdlupac.fsf_-_@Pro.fritz.box> (raw)
In-Reply-To: <556885424.775162.1698086427787@mail.yahoo.com> (Lewis Creary's message of "Mon, 23 Oct 2023 18:40:27 +0000 (UTC)")

Lewis Creary <lewcreary@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.







       reply	other threads:[~2023-10-23 19:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <556885424.775162.1698086427787.ref@mail.yahoo.com>
     [not found] ` <556885424.775162.1698086427787@mail.yahoo.com>
2023-10-23 19:11   ` Gerd Möllmann [this message]
2023-11-05  6:00     ` bug#66696: 29.1; "A bug in the function debug." Gerd Möllmann
     [not found] <1239664521.598080.1698039706916.ref@mail.yahoo.com>
2023-10-23  5:41 ` Lewis Creary via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-23  6:57   ` Gerd Möllmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m21qdlupac.fsf_-_@Pro.fritz.box \
    --to=gerd.moellmann@gmail.com \
    --cc=66696@debbugs.gnu.org \
    --cc=lewcreary@cs.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).