Skip to content

Commit

Permalink
the rest
Browse files Browse the repository at this point in the history
  • Loading branch information
kainino0x committed Oct 25, 2023
1 parent 70c3b03 commit d6be35d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/common/util/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ export function typedArrayParam<K extends keyof TypedArrayMap>(

export function createTypedArray<K extends keyof TypedArrayMap>(
type: K,
data: number[]
data: readonly number[]
): TypedArrayMap[K] {
return new kTypedArrayBufferViews[type](data) as TypedArrayMap[K];
}
Expand Down
30 changes: 10 additions & 20 deletions src/unittests/floating_point.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2582,8 +2582,7 @@ g.test('atanInterval')
return ulp_error * trait.oneULP(n);
};

t.params.expected = applyError(t.params.expected, error);
const expected = trait.toInterval(t.params.expected);
const expected = trait.toInterval(applyError(t.params.expected, error));

const got = trait.atanInterval(t.params.input);
t.expect(
Expand Down Expand Up @@ -2760,8 +2759,7 @@ g.test('cosInterval')
return t.params.trait === 'f32' ? 2 ** -11 : 2 ** -7;
};

t.params.expected = applyError(t.params.expected, error);
const expected = trait.toInterval(t.params.expected);
const expected = trait.toInterval(applyError(t.params.expected, error));

const got = trait.cosInterval(t.params.input);
t.expect(
Expand Down Expand Up @@ -2941,8 +2939,7 @@ g.test('expInterval')
return ulp_error * trait.oneULP(x);
};

t.params.expected = applyError(t.params.expected, error);
const expected = trait.toInterval(t.params.expected);
const expected = trait.toInterval(applyError(t.params.expected, error));
const got = trait.expInterval(t.params.input);

t.expect(
Expand Down Expand Up @@ -3001,8 +2998,7 @@ g.test('exp2Interval')
return ulp_error * trait.oneULP(x);
};

t.params.expected = applyError(t.params.expected, error);
const expected = trait.toInterval(t.params.expected);
const expected = trait.toInterval(applyError(t.params.expected, error));

const got = trait.exp2Interval(t.params.input);
t.expect(
Expand Down Expand Up @@ -3197,8 +3193,7 @@ g.test('inverseSqrtInterval')
return 2 * trait.oneULP(n);
};

t.params.expected = applyError(t.params.expected, error);
const expected = trait.toInterval(t.params.expected);
const expected = trait.toInterval(applyError(t.params.expected, error));

const got = trait.inverseSqrtInterval(t.params.input);
t.expect(
Expand Down Expand Up @@ -3322,8 +3317,7 @@ g.test('logInterval')
return 3 * trait.oneULP(n);
};

t.params.expected = applyError(t.params.expected, error);
const expected = trait.toInterval(t.params.expected);
const expected = trait.toInterval(applyError(t.params.expected, error));

const got = trait.logInterval(t.params.input);
t.expect(
Expand Down Expand Up @@ -3373,8 +3367,7 @@ g.test('log2Interval')
return 3 * trait.oneULP(n);
};

t.params.expected = applyError(t.params.expected, error);
const expected = trait.toInterval(t.params.expected);
const expected = trait.toInterval(applyError(t.params.expected, error));

const got = trait.log2Interval(t.params.input);
t.expect(
Expand Down Expand Up @@ -3720,8 +3713,7 @@ g.test('sinInterval')
return t.params.trait === 'f32' ? 2 ** -11 : 2 ** -7;
};

t.params.expected = applyError(t.params.expected, error);
const expected = trait.toInterval(t.params.expected);
const expected = trait.toInterval(applyError(t.params.expected, error));

const got = trait.sinInterval(t.params.input);
t.expect(
Expand Down Expand Up @@ -3855,8 +3847,7 @@ g.test('sqrtInterval')
return 2.5 * trait.oneULP(n);
};

t.params.expected = applyError(t.params.expected, error);
const expected = trait.toInterval(t.params.expected);
const expected = trait.toInterval(applyError(t.params.expected, error));

const got = trait.sqrtInterval(t.params.input);
t.expect(
Expand Down Expand Up @@ -4429,10 +4420,9 @@ g.test('divisionInterval')
};

const [x, y] = t.params.input;
t.params.expected = applyError(t.params.expected, error);

// Do not swizzle here, so the correct implementation under test is called.
const expected = FP[t.params.trait].toInterval(t.params.expected);
const expected = FP[t.params.trait].toInterval(applyError(t.params.expected, error));
const got = FP[t.params.trait].divisionInterval(x, y);
t.expect(
objectEquals(expected, got),
Expand Down
2 changes: 1 addition & 1 deletion src/webgpu/shader/execution/zero_init.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {

type ShaderTypeInfo =
| { type: 'container'; containerType: 'array'; elementType: ShaderTypeInfo; length: number }
| { type: 'container'; containerType: 'struct'; members: ShaderTypeInfo[] }
| { type: 'container'; containerType: 'struct'; members: readonly ShaderTypeInfo[] }
| {
type: 'container';
containerType: keyof typeof kVectorContainerTypeInfo | keyof typeof kMatrixContainerTypeInfo;
Expand Down

0 comments on commit d6be35d

Please sign in to comment.