Hi!

Im trying to make powers of two (2^x), but the result given is not what i would expect

Anyone can try this code and look at the serial monitor to get the results

```
void setup() {
byte tempB;
int tempI;
double tempD;
float tempF;
Serial.begin(115200);
for(byte x = 0; x < 8; x++){
tempB = pow(2, x);
tempI = pow(2, x);
tempD = pow(2, x);
tempF = pow(2, x);
Serial.print("Base 2, Exp ");
Serial.print(x);
Serial.print(" = B:");
Serial.print(tempB);
Serial.print(" I:");
Serial.print(tempI);
Serial.print(" D:");
Serial.print(tempD);
Serial.print(" F:");
Serial.println(tempF);
}
}
```

For this code, i get this output:

```
Base 2, Exp 0 = B:1 I:1 D:1.00 F:1.00
Base 2, Exp 1 = B:2 I:2 D:2.00 F:2.00
Base 2, Exp 2 = B:3 I:3 D:4.00 F:4.00
Base 2, Exp 3 = B:7 I:7 D:8.00 F:8.00
Base 2, Exp 4 = B:15 I:15 D:16.00 F:16.00
Base 2, Exp 5 = B:31 I:31 D:32.00 F:32.00
Base 2, Exp 6 = B:63 I:63 D:64.00 F:64.00
Base 2, Exp 7 = B:127 I:127 D:128.00 F:128.00
```

As you can see, for exponent 2 and up, the result of the pow() is one unit less than expected when this result is stored on a byte or an int.

I guess the problem is that the result given by pow() is an approximation, something like:

pow(2, 3) = 2^3 = 7.9999

So, when casting down, the decimal points are lost.

Ive tried to find out what was happening on the root:

http://svn.savannah.gnu.org/viewvc/avr-libc/branches/avr-libc-1_6-branch/avr-libc/libm/fplib/pow.S?revision=1533&view=markup

But my ASM skills are quite rusty

Any suggestion?