` input+=in*pow(10,i);`

The pow() function takes two arguments, both floats, and returns a float. The float may not be exactly what you expect.

Since what you want to do is multiply input by 10 and add in, why not just do that.

If the string being received is 12846, for instance, input is initially 0.

When the 1 is received, input gets multiplied by 10 (still 0) and 1 gets added, so input is 1.

When the 2 is received, input gets multiplied by 10 (now 10) and 2 gets added, so input is 12.

When the 8 is received, input gets multiplied by 10 (now 120) and 8 gets added, so input is 128.

When the 4 is received, input gets multiplied by 10 (now 1280) and 4 gets added, so input is 1284.

When the 6 is received, input gets multiplied by 10 (now 12840) and 6 gets added, so input is 12846.

No pow() calls are needed.