Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,12 @@ public class TestVectorOperationsWithPartialSize {

random.fill(random.ints(), ia);
random.fill(random.longs(), la);
random.fill(random.floats(), fa);
random.fill(random.doubles(), da);
// Use a range of 1~3000 for floating point values to keep the tests
// effectiveness while avoiding the large precision differences introduced
// by the add reduction APIs, especially since the Vector API does not
// guarantee a specific calculation order for such operations.
random.fill(random.uniformFloats(1.0f, 3000.0f), fa);
random.fill(random.uniformDoubles(1.0, 3000.0), da);
random.fill(random.uniformInts(0, ISPEC_128.length()), indices);
for (int i = 0; i < SIZE; i++) {
m[i] = i % 2 == 0;
Expand Down Expand Up @@ -160,7 +164,7 @@ private static int reduceLanes(int init, int[] arr, int vlen, binOpInt f) {
return result;
}

private static long reduceLanes(long init, long[] arr, int vlen,binOpLong f) {
private static long reduceLanes(long init, long[] arr, int vlen, binOpLong f) {
long result = init;
for (int i = 0; i < vlen; i++) {
result = f.apply(arr[i], result);
Expand Down Expand Up @@ -226,7 +230,6 @@ private static void verifyAddReductionFloat(float actual, float[] arr, int vlen)
float tolerance = Math.ulp(expected) * ROUNDING_ERROR_FACTOR_ADD;
if (Math.abs(expected - actual) > tolerance) {
throw new RuntimeException(
"assertEqualsWithTolerance" +
": expected " + expected + " but was " + actual +
" (tolerance: " + tolerance + ", diff: " + Math.abs(expected - actual) + ")"
);
Expand All @@ -243,7 +246,6 @@ private static void verifyAddReductionDouble(double actual, double[] arr, int vl
double tolerance = Math.ulp(expected) * ROUNDING_ERROR_FACTOR_ADD;
if (Math.abs(expected - actual) > tolerance) {
throw new RuntimeException(
"assertEqualsWithTolerance" +
": expected " + expected + " but was " + actual +
" (tolerance: " + tolerance + ", diff: " + Math.abs(expected - actual) + ")"
);
Expand Down