From: David Ongaro <david.ongaro@hamburg.de>
To: "Mattias Engdegård" <mattiase@acm.org>
Cc: 41279@debbugs.gnu.org
Subject: bug#41279: 26.3; Calc: sum(gcd(0,n),n,-1,-1) evaluates to -1
Date: Fri, 15 May 2020 10:44:07 -0700 [thread overview]
Message-ID: <20621430-4DFE-4E40-A616-9D404DDBB2BF@hamburg.de> (raw)
In-Reply-To: <7D48D15C-1F8E-41C8-9B1C-650215C8101D@acm.org>
On 15.05.20, 03:19, "Mattias Engdegård" <mattiase@acm.org> wrote:
> Thank you for reporting this. It seems that Calc first simplifies gcd(0,n) to n and then computes sum(n,n,-1,-1) = -1.
> We could either make gcd(0,x)=gcd(x,0)=|x|, or try preventing sum from simplifying its operand first, or both.
> For the smallest possible change, what about the hack below?
I see, so the simplest reproduction of the bug doesn't involve the sum, but just the evaluation of gcd(0, x) or gcd(x, 0). Your fix seems sensible to me, I don't see why you consider it a 'hack'. The simplification gcd(0, x)=gcd(x, 0)=abs(x) seems legit and matches the gcd definition "The largest positive integer that divides each of the integers".
next prev parent reply other threads:[~2020-05-15 17:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-15 4:52 bug#41279: 26.3; Calc: sum(gcd(0,n),n,-1,-1) evaluates to -1 David Ongaro
2020-05-15 10:19 ` Mattias Engdegård
2020-05-15 17:44 ` David Ongaro [this message]
2020-05-15 18:21 ` Mattias Engdegård
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20621430-4DFE-4E40-A616-9D404DDBB2BF@hamburg.de \
--to=david.ongaro@hamburg.de \
--cc=41279@debbugs.gnu.org \
--cc=mattiase@acm.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.