DONT MIND ALL THISI found a small problem that is more or less frustrating...

The ATmega328 is 16-bit and can therefore handle numbers up to 65'535, but not further.The long data type requires 32-bit so the CPU handles it a bit differently.(Theres also a long long data type which is 64-bit, but the same problem appears on that one)

If I declare a long long variable I can use it to calculate all and all no big problemslong long num = 5000;num += 2000;Serial.println(word(num));Gives out 7000 in respond.

But I have to convert the number to string to send it, therefore the word() function. But even if I print it on a LCD or anything it still got the problem.Now the problem is as follows: if the number is above 65535 it "resets" back to 0, or if you got some rest it gets added. For example65535L + 5Lgives 4 (it includes the 0) because it's actually 65536 (2^16) + 4.

You can check the "real" value for examplefloor( 80000L / 65536L )gives 1, so they are not exactly reset; it's just that when you get the string form of the long it can't handle numbers bigger then 65535 (which is max from 16-bit, aka 11111111 11111111 in binary is 65535 in decimal).

What? I should note that I can not use the serial because my IDE crashes when it gets multiple serial messages (I do not know why nor how to fix it). I am using my raspberry pi because my windows cant launch the IDE.