(mode)
| 76 | }); |
| 77 | |
| 78 | function precisionTest(mode) { |
| 79 | const gpu = new GPU({ mode }); |
| 80 | const add = gpu.createKernel(function(a, b) { |
| 81 | return a + b; |
| 82 | }) |
| 83 | .setOutput([1]) |
| 84 | .setTactic('precision'); |
| 85 | let addResult = add(0.1, 0.2)[0]; |
| 86 | assert.equal(addResult.toFixed(7), (0.1 + 0.2).toFixed(7)); |
| 87 | gpu.destroy(); |
| 88 | } |
| 89 | |
| 90 | test('precision auto', () => { |
| 91 | precisionTest(); |