You need to use long or double or something like that. I believe that int only goes from -32767 to 32766 (or something along those lines). So, once it hits the maximum, it's starting over at the minimum and continuing with the rest.

Don't quote me on the range, as I don't have my programming books right here. But it's definitely lower than what you're trying. So long would be the right choice (I believe)

Have a great day
Patrick