From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 23 12:15:55 2016 Received: (at submit) by debbugs.gnu.org; 23 Dec 2016 17:15:55 +0000 Received: from localhost ([127.0.0.1]:52877 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cKTRi-0005xP-J7 for submit@debbugs.gnu.org; Fri, 23 Dec 2016 12:15:55 -0500 Received: from eggs.gnu.org ([208.118.235.92]:45159) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cKN9N-0000mL-2f for submit@debbugs.gnu.org; Fri, 23 Dec 2016 05:32:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cKN9H-0008HS-Bb for submit@debbugs.gnu.org; Fri, 23 Dec 2016 05:32:27 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:53059) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cKN9H-0008HJ-8r for submit@debbugs.gnu.org; Fri, 23 Dec 2016 05:32:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36129) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cKN9G-0007LA-7I for bug-gnu-emacs@gnu.org; Fri, 23 Dec 2016 05:32:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cKN9D-0008FT-42 for bug-gnu-emacs@gnu.org; Fri, 23 Dec 2016 05:32:26 -0500 Received: from forward13o.cmail.yandex.net ([37.9.109.182]:39460) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cKN9C-0008EE-O1 for bug-gnu-emacs@gnu.org; Fri, 23 Dec 2016 05:32:23 -0500 Received: from mxback4j.mail.yandex.net (mxback4j.mail.yandex.net [5.45.198.18]) by forward13o.cmail.yandex.net (Yandex) with ESMTP id 600AE2126D for ; Fri, 23 Dec 2016 13:32:20 +0300 (MSK) Received: from web25j.yandex.ru (web25j.yandex.ru [5.45.198.66]) by mxback4j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id FVobKiJU2H-WJf4hNF7; Fri, 23 Dec 2016 13:32:19 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1482489139; bh=jXT7pGrCeYHKwgPYtzDMLIVIBL3Xe4dy624G5MIIDQg=; h=From:To:Subject:Message-Id:Date; b=wYLZBqiOrCt+A9qJ+DOScITAL8hmhI63jnlxA4OwouFJSHEaQbQtG4hRpTBRvEfQi qiyXHNGH0s/71cPH6agWBlIMklqceuJ65UtJ+JHAFHYc28ltcVIyQ6zNJWcRNTg2mh 56GqnDIt91FfihE0Bg9CPfFMcJ/MuVp6JsK6KkAs= Authentication-Results: mxback4j.mail.yandex.net; dkim=pass header.i=@yandex.ru Received: by web25j.yandex.ru with HTTP; Fri, 23 Dec 2016 13:32:19 +0300 From: Bug Poster To: bug-gnu-emacs@gnu.org Subject: Emacs calculator evalutes lcm to a negative number MIME-Version: 1.0 Message-Id: <112161482489139@web25j.yandex.ru> X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Fri, 23 Dec 2016 19:32:19 +0900 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Fri, 23 Dec 2016 12:15:53 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) GNU Emacs 24.3.1 This is formula of Least Common Multiple: lcm(a, b) = |a * b| / gcd(a, b) The calculator evaluates it, but doesn't take its absolute value. Input: 5 n 4 k l Output: 1: -20 From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 05 05:28:38 2017 Received: (at 25255) by debbugs.gnu.org; 5 Feb 2017 10:28:38 +0000 Received: from localhost ([127.0.0.1]:56493 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1caK3i-0002ft-Dv for submit@debbugs.gnu.org; Sun, 05 Feb 2017 05:28:38 -0500 Received: from tarrant.klingenberg.no ([80.91.231.253]:43806) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1caK3h-0002fl-Ex for 25255@debbugs.gnu.org; Sun, 05 Feb 2017 05:28:37 -0500 Received: from 179.51-175-138.customer.lyse.net ([51.175.138.179] helo=modesty.local) by tarrant.klingenberg.no with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1caK3V-0000ii-Ha for 25255@debbugs.gnu.org; Sun, 05 Feb 2017 11:28:34 +0100 Received: by modesty.local (Postfix, from userid 502) id 4BD5516C825E; Sun, 5 Feb 2017 11:28:17 +0100 (CET) From: peder@klingenberg.no (Peder O. Klingenberg) To: 25255@debbugs.gnu.org Subject: Re: bug#25255: Emacs calculator evalutes lcm to a negative number References: <112161482489139@web25j.yandex.ru> Date: Sun, 05 Feb 2017 11:28:17 +0100 In-Reply-To: <112161482489139@web25j.yandex.ru> (Bug Poster's message of "Fri, 23 Dec 2016 19:32:19 +0900") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (darwin) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.9 (--) X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 25255 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --=-=-= Content-Type: text/plain Bug Poster writes: > This is formula of Least Common Multiple: > > lcm(a, b) = |a * b| / gcd(a, b) I agree, every textbook I can find defines lcm to return a positive integer. Here's a patch, which hopefully someone will apply. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-LCM-is-defined-to-return-a-positive-integer.patch >From de52ee092bc0ab7c94d9270b9c3160c0923a68c0 Mon Sep 17 00:00:00 2001 From: "Peder O. Klingenberg" Date: Sun, 5 Feb 2017 10:58:00 +0100 Subject: [PATCH] LCM is defined to return a positive integer. Bug#25255: * doc/misc/calc.texi (Combinatorial Functions): The product of LCM and GCD is an absolute value. * lisp/calc/calc-comb.el (calcFunc-lcm): Use absolute values. --- doc/misc/calc.texi | 4 ++-- lisp/calc/calc-comb.el | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi index baf46f7170..7bd060189c 100644 --- a/doc/misc/calc.texi +++ b/doc/misc/calc.texi @@ -19111,8 +19111,8 @@ Combinatorial Functions @tindex lcm The @kbd{k l} (@code{calc-lcm}) [@code{lcm}] command computes the Least Common Multiple of two integers or fractions. The product of -the LCM and GCD of two numbers is equal to the product of the -numbers. +the LCM and GCD of two numbers is equal to the absolute value of the +product of the numbers. @kindex k E @pindex calc-extended-gcd diff --git a/lisp/calc/calc-comb.el b/lisp/calc/calc-comb.el index bc1ac315a0..c84ff23685 100644 --- a/lisp/calc/calc-comb.el +++ b/lisp/calc/calc-comb.el @@ -260,7 +260,7 @@ calcFunc-gcd (defun calcFunc-lcm (a b) (let ((g (calcFunc-gcd a b))) (if (Math-numberp g) - (math-div (math-mul a b) g) + (math-div (math-abs (math-mul a b)) g) (list 'calcFunc-lcm a b)))) (defun calcFunc-egcd (a b) ; Knuth section 4.5.2 -- 2.11.0 --=-=-= Content-Type: text/plain -- ...Peder... --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 05 05:36:37 2017 Received: (at control) by debbugs.gnu.org; 5 Feb 2017 10:36:37 +0000 Received: from localhost ([127.0.0.1]:56497 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1caKBR-0002sG-9L for submit@debbugs.gnu.org; Sun, 05 Feb 2017 05:36:37 -0500 Received: from tarrant.klingenberg.no ([80.91.231.253]:43820) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1caKBP-0002s7-SO for control@debbugs.gnu.org; Sun, 05 Feb 2017 05:36:36 -0500 Received: from 179.51-175-138.customer.lyse.net ([51.175.138.179] helo=modesty.local) by tarrant.klingenberg.no with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1caKBH-00017x-I0 for control@debbugs.gnu.org; Sun, 05 Feb 2017 11:36:33 +0100 Received: by modesty.local (Postfix, from userid 502) id 56B2B16C8423; Sun, 5 Feb 2017 11:36:21 +0100 (CET) To: control@debbugs.gnu.org From: peder@klingenberg.no (Peder O. Klingenberg) Subject: control message for bug #25255 Message-Id: <20170205103622.56B2B16C8423@modesty.local> Date: Sun, 5 Feb 2017 11:36:21 +0100 (CET) X-Spam-Score: -2.9 (--) X-SRS: Sender address rewritten from to by tarrant.klingenberg.no. X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.4 (/) tags 25255 patch From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 23 20:31:14 2017 Received: (at 25255) by debbugs.gnu.org; 24 Feb 2017 01:31:14 +0000 Received: from localhost ([127.0.0.1]:53406 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ch4j4-0005CA-5F for submit@debbugs.gnu.org; Thu, 23 Feb 2017 20:31:14 -0500 Received: from eggs.gnu.org ([208.118.235.92]:59446) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ch4j2-00056X-4J for 25255@debbugs.gnu.org; Thu, 23 Feb 2017 20:31:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ch4iw-0005KE-A5 for 25255@debbugs.gnu.org; Thu, 23 Feb 2017 20:31:07 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_40,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:48696) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ch4id-00051x-ER; Thu, 23 Feb 2017 20:30:47 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1ch4ic-0006LV-Vk; Thu, 23 Feb 2017 20:30:47 -0500 From: Glenn Morris To: peder@klingenberg.no (Peder O. Klingenberg) Subject: Re: bug#25255: Emacs calculator evalutes lcm to a negative number References: <112161482489139@web25j.yandex.ru> X-Spook: Disaster medical assistance team Smuggling SRI Colombia X-Ran: ~D1oyy6A"tl!JfVx=M#F[@5eWq@)95PZ>}]Q}-ox6>cnwMmnZP7b_?Z?j!c|:!nLF}ZW+4 X-Hue: yellow X-Attribution: GM Date: Thu, 23 Feb 2017 20:30:46 -0500 In-Reply-To: (Peder O. Klingenberg's message of "Sun, 05 Feb 2017 11:28:17 +0100") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 25255 Cc: bugzilla-mail-box@yandex.ru, 25255@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Peder O. Klingenberg wrote: > I agree, every textbook I can find defines lcm to return a positive > integer. Here's a patch, which hopefully someone will apply. Thanks; applied as f6d2ba7. From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 23 20:31:08 2017 Received: (at control) by debbugs.gnu.org; 24 Feb 2017 01:31:08 +0000 Received: from localhost ([127.0.0.1]:53403 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ch4ix-000579-U7 for submit@debbugs.gnu.org; Thu, 23 Feb 2017 20:31:08 -0500 Received: from eggs.gnu.org ([208.118.235.92]:59407) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ch4iw-00050r-8L for control@debbugs.gnu.org; Thu, 23 Feb 2017 20:31:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ch4iq-0005HB-F5 for control@debbugs.gnu.org; Thu, 23 Feb 2017 20:31:01 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:48705) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ch4iq-0005Gx-CT for control@debbugs.gnu.org; Thu, 23 Feb 2017 20:31:00 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1ch4iq-0006Pd-28 for control@debbugs.gnu.org; Thu, 23 Feb 2017 20:31:00 -0500 Subject: control message for bug 25255 To: X-Mailer: mail (GNU Mailutils 2.99.98) Message-Id: From: Glenn Morris Date: Thu, 23 Feb 2017 20:31:00 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) close 25255 26.1 From unknown Sat Jun 21 10:34:39 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 24 Mar 2017 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator