base: the number (float)
exponent: the power to which the base is raised (float)
The result of the exponentiation (double)
--
--
--
Also, make sure you are not looping too many times. That is a 32-bit signed int (I may be wrong but I am fairly sure it will use a signed bit) meaning that you have 32 bits to work with to represent a number and that the 32nd bit is a flag bit indicating negative. So an example in 8-bits would be:
00010010 = 18
10010010 = -18 (not 146)
Meaning that you only have half the range for positive and half for negative. How all this effects you is that if you try to rotate to the 32nd bit you are not going to get what you expect and if you rotate past that you are going to loop back to 1 (assuming it is rotating and not shifting. If it is shifting then you will just get only zero after you pass the 32nd bit.)
Ed,
Understood! I originally chose pow() to do my calculations, when bit shifting was really what I was after. :)
--
It could also be doing the 2s compliment in which case you would get a very large negative number and then all zeros.
Most microcontrollers have a rotate and a shift operation. The << and >> operators are shift. An int in c/c++ does not have a standard size. Since the arduino is based on an avr it has an internal data size if 8 bits. Most likely the compiler is setup for 16 bit integers.
An avr is designed around 2's compliment numbers because they make much more sense than sign and magnitude.
Ray Scheufler
--
Yeah, I realized that about ten minutes later. That will teach me not to post answers within 5 minutes of waking up. But yes. 2s compliment.
--