is it a type mismatch between the data and the long data type?Try declaring i as a double instead maybe?