Share your experience!
I have noticed that a very serious problem exists in Xperia XA (perhaps related to its CPU) that results in unpredictable and wrong calculations on correct Java code. The following code which just reads values from an array and writes them somewhere else, starts to return wrong results after some repetitions.
I have also open a Stack Overflow ticket:
https://stackoverflow.com/posts/48008766/
The test code:
public static void runTest() { long[] t = new long[]{ 23,41, 60, 44, 28, 45, 34, 35, 47, 46, 19, 63, 44, 14, 36, 69}; for(int i = 0; i < 40; i++) { long[] output = calculate(t); Log.e("TEST", Arrays.toString(output)); } } private static long[] calculate(long[] input) { long[] result = new long[31]; for (int i = 0; i < 16; i ++) { for (int j = 0; j < 16; j++) {
result[i + j] = input[i] + 1; } } return result; }
After 7-8 repetitions, instead of printint the correct output, which is:
[24, 42, 61, 45, 29, 46, 35, 36, 48, 47, 20, 64, 45, 15, 37, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70]
,it starts printing:
[24.0, 61.0, 29.0, 35.0, 48.0, 20.0, 45.0, 37.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
The code is 100% correct and is a simplified version of the actual code where I noticed a problem with my app. What is the cause of the problem?