Strange adding behaviour
No, there is nothing "wrong" there. In fact it's the expected results.

The problem here is that pow() returns a float, and some numbers just can't be represented with floating point. When that floating point value is converted to an integer it truncates the decimal portion leaving you with the wrong integer value.

void setup() {
    Serial.begin(115200);

    int t = 0;
    for (int i = 0; i &lt; 8; i++) {
        float f = pow(2, i);
        int d = f;
        t += f;
        Serial.print("2^");
        Serial.print(i);
        Serial.print(": float = ");
        Serial.print(f, 10);
        Serial.print(" int = ");
        Serial.print(d);
        Serial.print(" total = ");
        Serial.println(t);
    }
}

void loop() {
}

2^0: float = 1.0000000000 int = 1 total = 1
2^1: float = 2.0000000000 int = 2 total = 3
2^2: float = 3.9999995231 int = 3 total = 6
2^3: float = 7.9999980926 int = 7 total = 13
2^4: float = 15.9999961853 int = 15 total = 28
2^5: float = 31.9999885559 int = 31 total = 59
2^6: float = 63.9999771118 int = 63 total = 122
2^7: float = 127.9999542236 int = 127 total = 249


Instead you should use bit-shifting to perform the same operation on an integer:

void setup() {
    Serial.begin(115200);

    int t = 0;
    for (int i = 0; i &lt; 8; i++) {
        int d = 1 &lt;&lt; i;
        t += d;
        Serial.print("1&lt;&lt;");
        Serial.print(i);
        Serial.print(": int = ");
        Serial.print(d);
        Serial.print(" total = ");
        Serial.println(t);
    }
}

void loop() {
}

1&lt;&lt;0: int = 1 total = 1
1&lt;&lt;1: int = 2 total = 3
1&lt;&lt;2: int = 4 total = 7
1&lt;&lt;3: int = 8 total = 15
1&lt;&lt;4: int = 16 total = 31
1&lt;&lt;5: int = 32 total = 63
1&lt;&lt;6: int = 64 total = 127
1&lt;&lt;7: int = 128 total = 255