From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ramakrishnan Muthukrishnan Newsgroups: gmane.lisp.guile.devel Subject: Re: fix for expt bug Date: Wed, 3 Nov 2010 23:55:00 +0530 Message-ID: References: <8762whnc4d.fsf@yeeloong.netris.org> <87r5f4l3yt.fsf@yeeloong.netris.org> <87aalrxim7.fsf@yeeloong.netris.org> <87wrouwf6b.fsf@yeeloong.netris.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1288808743 14668 80.91.229.12 (3 Nov 2010 18:25:43 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 3 Nov 2010 18:25:43 +0000 (UTC) Cc: guile-devel To: Mark H Weaver Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Nov 03 19:25:38 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 1PDi1b-0002oL-89 for guile-devel@m.gmane.org; Wed, 03 Nov 2010 19:25:31 +0100 Original-Received: from localhost ([127.0.0.1]:58095 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PDi1a-0005jI-LE for guile-devel@m.gmane.org; Wed, 03 Nov 2010 14:25:30 -0400 Original-Received: from [140.186.70.92] (port=41909 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PDi1V-0005hf-06 for guile-devel@gnu.org; Wed, 03 Nov 2010 14:25:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PDi1T-0005RE-Kq for guile-devel@gnu.org; Wed, 03 Nov 2010 14:25:24 -0400 Original-Received: from mail-qw0-f41.google.com ([209.85.216.41]:37872) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PDi1T-0005R6-Bd for guile-devel@gnu.org; Wed, 03 Nov 2010 14:25:23 -0400 Original-Received: by qwi2 with SMTP id 2so320049qwi.0 for ; Wed, 03 Nov 2010 11:25:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=04BbOloJdzbHz/1Gmwyct0k0YyJTeH3vDLB4KhwMEmI=; b=PCW1OiCvtqiG0dmR53Iqu7WzM0zPQzcSiFmQMgfJIP0V43KiiwJsZuxzsPksub6jbw StGVRFl3M9Kfy4p5fYhOGV1ghV1EF//XtDQejcnDV+/WYquCO3znCtmlDPc8oeNM3mor swNIZJ0h6uitGm9/Aw6oEisIAfRz+tpjw+0/I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=knkzchmB7eezrzLHMByfzvxycP3knrR1qIOSsMmy7zWM4gG4RIm2g38cRKF3MW4KE1 DqAb6ph0qbYchii7Axln0N3lb4EAm4B2qF5pius2GGthyKkI8J7t+LqViCl9pbeX2moE dFDcGovFzYXjvv5Qp0ni7/Ove5YuGZQbacBqw= Original-Received: by 10.229.185.145 with SMTP id co17mr17582174qcb.108.1288808722077; Wed, 03 Nov 2010 11:25:22 -0700 (PDT) Original-Received: by 10.229.40.147 with HTTP; Wed, 3 Nov 2010 11:25:00 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) 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:11112 Archived-At: On Wed, Nov 3, 2010 at 11:23 PM, Ramakrishnan Muthukrishnan wrote: > On Wed, Nov 3, 2010 at 9:52 PM, Mark H Weaver wrote: >> Ramakrishnan and others, >> >> I just realized that there is a better way to fix these bugs. =C2=A0We d= on't >> need a new top-level case in expt after all. =C2=A0Instead, we generaliz= e the >> scm_integer_expt case to support inexact integer exponents. >> >> Within that case, if the exponent is an inexact integer, then we make it >> exact and make the base inexact, and then call scm_integer_expt. > > Mark, > > Why do we need to convert the base to inexact? is there any problem if > they are just as it is and we convert only the exponent to exact when > they are exact? scheme@(guile-user)> (integer-expt (exact->inexact 3/2) (inexact->exact 4.0= )) $17 =3D 5.0625 scheme@(guile-user)> (integer-expt 3/2 (inexact->exact 4.0)) $18 =3D 81/16 scheme@(guile-user)> (integer-expt (exact->inexact 3/2) (inexact->exact 4.0= )) $19 =3D 5.0625 We want an output representation in an inexact form. For that reason, we would want to do exact to inexact conversion of base. Is that correct? Mark, I guess your patch solves the problem in a much more efficient way. thanks --=20 =C2=A0 Ramakrishnan