-
Bug
-
Resolution: Unresolved
-
P4
-
8, 9
-
x86_64
-
windows_7
FULL PRODUCT VERSION :
1.8.0_101-b13
ADDITIONAL OS VERSION INFORMATION :
Windows 7
A DESCRIPTION OF THE PROBLEM :
The result sorted by Arrays.parallelSort(double[]) is different from the result sorted by Arrays.sort(double[]).
It can be repeatedly reproduced on my laptop: OS: windows 7 64 bit, CPU: Intel i7-3520M, memory: 16G, 1.8.0_101-b13
Please refer to the unit test in "steps to reproduce"
REGRESSION. Last worked in version 8u101
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Here is unit test to verify the bug:
@Test
public void test_parallelSort_double() throws Exception {
assertTrue(Double.compare(Double.NaN, Double.NaN) == 0);
final Random rand = new Random();
final int maxSize = 10000;
for (int i = 0; i < 13; i++) {
double[] a = new double[rand.nextInt(maxSize)];
for (int j = 0, len = a.length; j < len; j++) {
a[j] = j % 3 == 0 ? Double.NaN : rand.nextFloat();
}
double[] b = a.clone();
double[] c = a.clone();
Arrays.sort(b);
Arrays.parallelSort(c);
for (int k = 0, len = a.length; k < len; k++) {
if (Double.compare(b[k], c[k]) != 0) {
System.out.println(k + ": " + b[k] + ": " + c[k]);
// System.out.println(Arrays.toString(b));
// System.out.println(Arrays.toString(c));
throw new RuntimeException("Test failed");
}
}
}
}
REPRODUCIBILITY :
This bug can be reproduced always.
1.8.0_101-b13
ADDITIONAL OS VERSION INFORMATION :
Windows 7
A DESCRIPTION OF THE PROBLEM :
The result sorted by Arrays.parallelSort(double[]) is different from the result sorted by Arrays.sort(double[]).
It can be repeatedly reproduced on my laptop: OS: windows 7 64 bit, CPU: Intel i7-3520M, memory: 16G, 1.8.0_101-b13
Please refer to the unit test in "steps to reproduce"
REGRESSION. Last worked in version 8u101
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Here is unit test to verify the bug:
@Test
public void test_parallelSort_double() throws Exception {
assertTrue(Double.compare(Double.NaN, Double.NaN) == 0);
final Random rand = new Random();
final int maxSize = 10000;
for (int i = 0; i < 13; i++) {
double[] a = new double[rand.nextInt(maxSize)];
for (int j = 0, len = a.length; j < len; j++) {
a[j] = j % 3 == 0 ? Double.NaN : rand.nextFloat();
}
double[] b = a.clone();
double[] c = a.clone();
Arrays.sort(b);
Arrays.parallelSort(c);
for (int k = 0, len = a.length; k < len; k++) {
if (Double.compare(b[k], c[k]) != 0) {
System.out.println(k + ": " + b[k] + ": " + c[k]);
// System.out.println(Arrays.toString(b));
// System.out.println(Arrays.toString(c));
throw new RuntimeException("Test failed");
}
}
}
}
REPRODUCIBILITY :
This bug can be reproduced always.