Exponentiation by Squaring |
But then somebody points out that Wikipedia has an article titled Exponentiation by Squaring which is a dozen or so screens of mathematical gibberish, and the somebody else points out that there is the Simple Wikipedia which also has an article on the same subject and it is only one screenful. I like Simple Wikipedia. I use Wikipedia all the time. Mostly it doesn't give me any trouble, but sometimes it gets really deep, and sometimes that is too deep for me.
The technique is overkill for my problem, so I will just roll my own.
It is also wrong.
ReplyDeleteOr rather, incomplete.
The case for n=0 (i.e returning 1) is not covered.
Nor can it cope with negative or imaginary numbers for n.