Re: calculating an exponent?
From: Jani Yusef (jani_at_persian.com)
Date: 09/28/04
- Next message: Alf P. Steinbach: "Re: calculating an exponent?"
- Previous message: Monica: "Re: midi- note on/off"
- In reply to: Alf P. Steinbach: "Re: calculating an exponent?"
- Next in thread: Alf P. Steinbach: "Re: calculating an exponent?"
- Reply: Alf P. Steinbach: "Re: calculating an exponent?"
- Reply: Thad Smith: "Re: calculating an exponent?"
- Reply: Paul Lutus: "Re: calculating an exponent?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 28 Sep 2004 11:27:56 -0400
Alf P. Steinbach wrote:
> * Jani Yusef:
>
>>Ok, this one has me stumped.
>>Is it possible to calculate an exponent, say, a^n, using only right
>>and left shifts along with additions and subtractions?
>
>
> All arithmetic operations are implemented that way (in software or hardware).
>
> Presumably 'a' and 'n' are non-negative integers.
>
> The only question is then how (in)efficient you want the algorithm to
> be. For efficiency it might be a good idea to first consider efficient
> multiplication. With multiplication you can then tackle the efficiency of the
> exponentiation, e.g. by noting treating odd n and even n differently.
Hmmm, thats interesting but I am still confused as to how this is done?
Suppose I want to calculate 2^5 , for example. What would the
calculation look like. Would it be broken down first into
2*(2*2)*(2*2) ors omething like that? How is that different then, say,
and even exponent? Sorry for all the questions but I really don't
understand this at all.
- Next message: Alf P. Steinbach: "Re: calculating an exponent?"
- Previous message: Monica: "Re: midi- note on/off"
- In reply to: Alf P. Steinbach: "Re: calculating an exponent?"
- Next in thread: Alf P. Steinbach: "Re: calculating an exponent?"
- Reply: Alf P. Steinbach: "Re: calculating an exponent?"
- Reply: Thad Smith: "Re: calculating an exponent?"
- Reply: Paul Lutus: "Re: calculating an exponent?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|