Strange readings or bug ADXL335-BB with ArduLog?

Read my answer #5 - I think this is the real issue. Try with unsigned long instead of int in you sum 40 Times a value close to 1000 you will overflow your int - that is 100% guaranteed and it’s not an IDE issue