[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fix for expt bug

From: Ramakrishnan Muthukrishnan
Subject: Re: fix for expt bug
Date: Wed, 3 Nov 2010 23:55:00 +0530

On Wed, Nov 3, 2010 at 11:23 PM, Ramakrishnan Muthukrishnan
<address@hidden> wrote:
> On Wed, Nov 3, 2010 at 9:52 PM, Mark H Weaver <address@hidden> wrote:
>> Ramakrishnan and others,
>> I just realized that there is a better way to fix these bugs.  We don't
>> need a new top-level case in expt after all.  Instead, we generalize 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 = 5.0625
scheme@(guile-user)> (integer-expt 3/2 (inexact->exact 4.0))
$18 = 81/16
scheme@(guile-user)> (integer-expt (exact->inexact 3/2) (inexact->exact 4.0))
$19 = 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

Mark, I guess your patch solves the problem in a much more efficient way.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]