1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
export const description = `
Execution Tests for the f32 arithmetic unary expression operations
`;
import { makeTestGroup } from '../../../../../common/framework/test_group.js';
import { GPUTest } from '../../../../gpu_test.js';
import { TypeF32 } from '../../../../util/conversion.js';
import { negationInterval } from '../../../../util/f32_interval.js';
import { fullF32Range } from '../../../../util/math.js';
import { makeCaseCache } from '../case_cache.js';
import { allInputSources, generateUnaryToF32IntervalCases, run } from '../expression.js';
import { unary } from './unary.js';
export const g = makeTestGroup(GPUTest);
export const d = makeCaseCache('unary/f32_arithmetic', {
negation: () => {
return generateUnaryToF32IntervalCases(
fullF32Range({ neg_norm: 250, neg_sub: 20, pos_sub: 20, pos_norm: 250 }),
'unfiltered',
negationInterval
);
},
});
g.test('negation')
.specURL('https://www.w3.org/TR/WGSL/#floating-point-evaluation')
.desc(
`
Expression: -x
Accuracy: Correctly rounded
`
)
.params(u =>
u.combine('inputSource', allInputSources).combine('vectorize', [undefined, 2, 3, 4] as const)
)
.fn(async t => {
const cases = await d.get('negation');
await run(t, unary('-'), [TypeF32], TypeF32, t.params, cases);
});
|