Converting from Float to Int yielding weird results. What am I doing wrong?
On an Arduino board with the 328 processor, an INT is stored as a 2 byte value, so the max number is 32,767.
You want to use a LONG which is a 4 byte number which has a max of 2,147,483,647.
When the variable you are using is not big enough, the number rolls over, which is why you end up getting a negative number.