I am having a temporary lapse of judgement, or not understanding how the power method works, but when I put 10 to the power of a number, it is that value -1. So:
10*10 = 100
Then I would assume, 10^2 = 100
So if I had a variable i
, that was equal to 2
, and I asked arduino for 10
to the power of i
, I would expect it to do 10^2
, and then give me 100
, but instead I get 99
. What am I missing?
void setup() {
Serial.begin(9600);
}
void loop() {
for (int i =0; i<5; i++){
int power = i;
Serial.print(power);
Serial.print(":");
int multiplier = pow(10,power);
Serial.println(multiplier);
}
}