From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: David Ongaro Newsgroups: gmane.emacs.bugs Subject: bug#41279: 26.3; Calc: sum(gcd(0,n),n,-1,-1) evaluates to -1 Date: Thu, 14 May 2020 21:52:56 -0700 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="64482"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Microsoft-MacOutlook/16.37.20051002 To: 41279@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri May 15 06:54:11 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jZSMM-000Gf0-Es for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 15 May 2020 06:54:10 +0200 Original-Received: from localhost ([::1]:54316 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZSML-0008G5-1m for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 15 May 2020 00:54:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44150) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZSMF-0008Fv-Ly for bug-gnu-emacs@gnu.org; Fri, 15 May 2020 00:54:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52308) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZSME-0003aA-C8 for bug-gnu-emacs@gnu.org; Fri, 15 May 2020 00:54:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jZSME-0003ic-BA for bug-gnu-emacs@gnu.org; Fri, 15 May 2020 00:54:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: David Ongaro Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 15 May 2020 04:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 41279 X-GNU-PR-Package: emacs X-Debbugs-Original-To: Original-Received: via spool by submit@debbugs.gnu.org id=B.158951839814220 (code B ref -1); Fri, 15 May 2020 04:54:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 15 May 2020 04:53:18 +0000 Original-Received: from localhost ([127.0.0.1]:35621 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jZSLW-0003hI-EA for submit@debbugs.gnu.org; Fri, 15 May 2020 00:53:18 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:53376) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jZSLS-0003h8-Do for submit@debbugs.gnu.org; Fri, 15 May 2020 00:53:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44004) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZSLS-0008EI-5g for bug-gnu-emacs@gnu.org; Fri, 15 May 2020 00:53:14 -0400 Original-Received: from cosmopolitan.ops.eusc.inter.net ([2001:1560:3:255::151]:60694) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZSLQ-0003HS-MM for bug-gnu-emacs@gnu.org; Fri, 15 May 2020 00:53:13 -0400 Original-X-Trace: 4c7c64617669642e6f6e6761726f4068616d627572672e64657c3137342e32312e 3130372e3134397c316a5a534c472d3030303249722d33457c3135383935313833 3832 Original-Received: from cosmopolitan.ops.eusc.inter.net ([10.151.10.15] helo=localhost) by cosmopolitan.ops.eusc.inter.net with esmtpsa (Exim 4.93.0.4) id 1jZSLG-0002Ir-3E for bug-gnu-emacs@gnu.org; Fri, 15 May 2020 06:53:02 +0200 Thread-Topic: 26.3; Calc: sum(gcd(0,n),n,-1,-1) evaluates to -1 X-SA-Exim-Connect-IP: 174.21.107.149 X-SA-Exim-Mail-From: david.ongaro@hamburg.de X-SA-Exim-Scanned: No (on cosmopolitan.ops.eusc.inter.net); SAEximRunCond expanded to false Received-SPF: pass client-ip=2001:1560:3:255::151; envelope-from=david.ongaro@hamburg.de; helo=cosmopolitan.ops.eusc.inter.net X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:180288 Archived-At: By accident I noticed that this algebraic expression yields 6 instead of 8 which would be correct: =C2=A0=C2=A0=C2=A0=C2=A0sum(sum(gcd(n, k), k, -1, 1), n, -1, 1) =3D> 6 I could narrow it down to this, which yields -1 instead of 1 =C2=A0=C2=A0=C2=A0=C2=A0sum(gcd(0, n), n , -1, -1) =3D> -1 Notably gcd(0, -1) evaluates to 1 as it should be. Also we have =C2=A0=C2=A0=C2=A0=C2=A0sum(gcd(n, 0), n, -1, -1) =3D> -1 but =C2=A0=C2=A0=C2=A0=C2=A0sum(sum(gcd(n, k), k, 0, 0), n, -1, -1) =3D> -1 =C2=A0=C2=A0=C2=A0=C2=A0sum(sum(gcd(n, k), k, -1, -1), n, 0, 0) =3D> 1 which violates gcd(n, k) =3D gcd(k, n). We also have =C2=A0=C2=A0=C2=A0=C2=A0sum(sum(gcd(n, k) =3D 1, k, -1, 1), n, -1, 1) =3D> 7 =C2=A0=C2=A0=C2=A0=C2=A0sum(sum(abs(gcd(n, k)), k, -1, 1), n, -1, 1) =3D> 8 which seems to confirm that it's not just the sum function but the combination of sum and gcd which might introduce the problem. To reproduce you can simply enter Calc embedded mode with C-x 8 e in a buffer with this email content, put the point on a corresponding formular and reevaluate with SPACE. I'd appreciate if this could be fixed. David In GNU Emacs 26.3 (build 1, x86_64-apple-darwin18.2.0, NS appkit-1671.20 Ve= rsion 10.14.3 (Build 18D109)) of 2019-09-02 built on builder10-14.porkrind.org Windowing system distributor 'Apple', version 10.3.1894 Recent messages: previous-line: Beginning of buffer [2 times] (Switching Calc Embedded mode to new formula.) [5 times] Working... [3 times] (Canceled) C-c C-c is undefined [2 times] (Switching Calc Embedded mode to new formula.) [9 times] user-error: Beginning of history; no preceding item [3 times] Quit Making completion list... [2 times] user-error: Beginning of history; no preceding item Configured using: 'configure --with-ns '--enable-locallisppath=3D/Library/Application Support/Emacs/${version}/site-lisp:/Library/Application Support/Emacs/site-lisp' --with-modules' Configured features: NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES THREADS Important settings: =C2=A0=C2=A0value of $LC_ALL: en_US.utf-8 =C2=A0=C2=A0value of $LC_CTYPE: UTF-8 =C2=A0=C2=A0value of $LANG: en_US.utf-8 =C2=A0=C2=A0locale-coding-system: utf-8-unix Major mode: Fundamental Minor modes in effect: =C2=A0=C2=A0tooltip-mode: t =C2=A0=C2=A0global-eldoc-mode: t =C2=A0=C2=A0electric-indent-mode: t =C2=A0=C2=A0mouse-wheel-mode: t =C2=A0=C2=A0tool-bar-mode: t =C2=A0=C2=A0menu-bar-mode: t =C2=A0=C2=A0file-name-shadow-mode: t =C2=A0=C2=A0global-font-lock-mode: t =C2=A0=C2=A0font-lock-mode: t =C2=A0=C2=A0blink-cursor-mode: t =C2=A0=C2=A0auto-composition-mode: t =C2=A0=C2=A0auto-encryption-mode: t =C2=A0=C2=A0auto-compression-mode: t =C2=A0=C2=A0buffer-read-only: t =C2=A0=C2=A0line-number-mode: t =C2=A0=C2=A0transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv bytecomp byte-compile cconv dired dired-loaddefs format-spec rfc822 mml mml-sec password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils calc-arith calc-prog calc-yank calccomp calcalg2 calc-misc calc-comb calc-map calc-alg calc-aent cl-seq calc-menu easymenu calc-embed cl-loaddefs cl-lib calc-ext calc calc-loaddefs calc-macs elec-pair time-date tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads kqueue cocoa ns multi-tty make-network-process emacs) Memory information: ((conses 16 243141 10243) (symbols 48 24190 1) (miscs 40 99 401) (strings 32 37828 1759) (string-bytes 1 996761) (vectors 16 38186) (vector-slots 8 766279 17952) (floats 8 49 73) (intervals 56 315 13) (buffers 992 15))