On Wed, Nov 3, 2010 at 11:23 PM, Ramakrishnan Muthukrishnan <[email protected]> wrote: > On Wed, Nov 3, 2010 at 9:52 PM, Mark H Weaver <[email protected]> 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 correct? Mark, I guess your patch solves the problem in a much more efficient way. thanks -- Ramakrishnan
