Re: [j-devel] PATCH: Bignum exponent for EXPT From: Erik Huelsmann - 2008-08-15 05:37 ```2008/2/18 Robert Dodier : > Hello, > > The CLHS says the exponent for EXPT is a number, > and bignums are numbers, so EXPT should accept a > bignum exponent. At present ABCL rejects bignum > exponents. > > I've attached a patch which handles fixnum^bignum. > > Whether or not it is meaningful to compute EXPT when > the exponent is a bignum is not immediately relevant. > > Incidentally the bignum exponent rejection causes at > least one error in Maxima, which is how I discovered it. In your patch, there's also a note on some code in MathFunctions.lisp; it's about repeated multiplication in expt calculations versus repeated squaring. How about the attached patch? Bye, Erik. ```

 Re: [j-devel] PATCH: Bignum exponent for EXPT From: Erik Huelsmann - 2008-08-13 16:50 ```2008/2/18 Robert Dodier : > Hello, > > The CLHS says the exponent for EXPT is a number, > and bignums are numbers, so EXPT should accept a > bignum exponent. At present ABCL rejects bignum > exponents. > > I've attached a patch which handles fixnum^bignum. > > Whether or not it is meaningful to compute EXPT when > the exponent is a bignum is not immediately relevant. > > Incidentally the bignum exponent rejection causes at > least one error in Maxima, which is how I discovered it. > > FWIW Hi! I was reading your patch and I saw you're doing: y = y.divideBy(BIGINTEGER_TWO); Wouldn't it be better to use: y = y.shiftLeft(1); though? I still need to understand how the rest of it fits into the system though, but that may take some time. This is just my reaction to the initial implementation. Bye, Erik. ```
 Re: [j-devel] PATCH: Bignum exponent for EXPT From: Robert Dodier - 2008-08-14 13:55 ```--- On Wed, 8/13/08, Erik Huelsmann wrote: > I was reading your patch and I saw you're doing: > > y = y.divideBy(BIGINTEGER_TWO); > > Wouldn't it be better to use: > > y = y.shiftLeft(1); I guess so, if y is positive. (I think there is some logic to ensure that y is positive, but I don't remember exactly.) Thanks for your help, Robert Dodier ```
 Re: [j-devel] PATCH: Bignum exponent for EXPT From: Erik Huelsmann - 2008-08-14 15:28 ```On Thu, Aug 14, 2008 at 3:55 PM, Robert Dodier wrote: > --- On Wed, 8/13/08, Erik Huelsmann wrote: > >> I was reading your patch and I saw you're doing: >> >> y = y.divideBy(BIGINTEGER_TWO); >> >> Wouldn't it be better to use: >> >> y = y.shiftLeft(1); > > I guess so, if y is positive. (I think there is some logic > to ensure that y is positive, but I don't remember exactly.) Yup. That logic is there. Committed the patch to the trunk. Bye, Erik. ```
 Re: [j-devel] PATCH: Bignum exponent for EXPT From: Erik Huelsmann - 2008-08-15 05:37 Attachments: repeated-squaring.patch ```2008/2/18 Robert Dodier : > Hello, > > The CLHS says the exponent for EXPT is a number, > and bignums are numbers, so EXPT should accept a > bignum exponent. At present ABCL rejects bignum > exponents. > > I've attached a patch which handles fixnum^bignum. > > Whether or not it is meaningful to compute EXPT when > the exponent is a bignum is not immediately relevant. > > Incidentally the bignum exponent rejection causes at > least one error in Maxima, which is how I discovered it. In your patch, there's also a note on some code in MathFunctions.lisp; it's about repeated multiplication in expt calculations versus repeated squaring. How about the attached patch? Bye, Erik. ```
 Re: [j-devel] PATCH: Bignum exponent for EXPT From: Robert Dodier - 2008-08-15 14:04 ```--- On Thu, 8/14/08, Erik Huelsmann wrote: > In your patch, there's also a note on some code in > MathFunctions.lisp; it's about repeated multiplication > in expt calculations versus repeated squaring. > > How about the attached patch? OK by me. Thanks for taking a look at this problem. best Robert Dodier ```