From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.devel Subject: Re: fix for expt bug Date: Wed, 03 Nov 2010 11:32:28 -0400 Message-ID: <8762wexw1f.fsf@yeeloong.netris.org> References: <8762whnc4d.fsf@yeeloong.netris.org> <87r5f4l3yt.fsf@yeeloong.netris.org> <87aalrxim7.fsf@yeeloong.netris.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1288799728 31962 80.91.229.12 (3 Nov 2010 15:55:28 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 3 Nov 2010 15:55:28 +0000 (UTC) Cc: guile-devel To: Ramakrishnan Muthukrishnan Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Nov 03 16:55:23 2010 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PDfg7-0000NJ-Sf for guile-devel@m.gmane.org; Wed, 03 Nov 2010 16:55:12 +0100 Original-Received: from localhost ([127.0.0.1]:54412 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PDfg7-0005j9-DO for guile-devel@m.gmane.org; Wed, 03 Nov 2010 11:55:11 -0400 Original-Received: from [140.186.70.92] (port=56954 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PDfKU-0003QO-GM for guile-devel@gnu.org; Wed, 03 Nov 2010 11:32:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PDfKP-0007iM-Js for guile-devel@gnu.org; Wed, 03 Nov 2010 11:32:50 -0400 Original-Received: from world.peace.net ([216.204.32.208]:46464) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PDfKP-0007gJ-GM for guile-devel@gnu.org; Wed, 03 Nov 2010 11:32:45 -0400 Original-Received: from ip68-9-118-38.ri.ri.cox.net ([68.9.118.38] helo=freedomincluded) by world.peace.net with esmtpa (Exim 4.69) (envelope-from ) id 1PDfKA-0002Ze-Ap; Wed, 03 Nov 2010 11:32:30 -0400 Original-Received: from mhw by freedomincluded with local (Exim 4.69) (envelope-from ) id 1PDfK8-0005iB-Cc; Wed, 03 Nov 2010 11:32:28 -0400 In-Reply-To: (Ramakrishnan Muthukrishnan's message of "Wed, 3 Nov 2010 15:11:46 +0530") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:11108 Archived-At: Hi Ramakrishnan, We're almost there, but you neglected one of the comments I made about your previous patch. > + /* If base is negative, expt needs to find -x^n = (-1^n) * (x^n). > + We find x^n and then if n is odd, we also multiply the result > + with -1. These changes apply only for cases where n is an > + integer. > + */ I repeat: In the equation above, -x^n parses as -(x^n), but it should be (-x)^n. Same problem with (-1^n). Exponentiation has higher precedence than negation. The equation above should be: (-x)^n = (-1)^n * x^n Feel free to add more parentheses if you like, but the ones I have included are essential and must not be removed. Everything else looks good to me. Thanks, Mark