Skip to content

Commit 47e7b48

Browse files
Merge pull request #352 from gpujs/349-division-by-factors-of-3
test for 6030401/3991 too
2 parents d082d10 + 03077ce commit 47e7b48

File tree

6 files changed

+21
-17
lines changed

6 files changed

+21
-17
lines changed

bin/gpu-core.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* GPU Accelerated JavaScript
66
*
77
* @version 1.5.4
8-
* @date Thu Jul 26 2018 08:57:20 GMT+0100 (BST)
8+
* @date Thu Jul 26 2018 17:35:34 GMT+0100 (BST)
99
*
1010
* @license MIT
1111
* The MIT License

bin/gpu-core.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/gpu.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* GPU Accelerated JavaScript
66
*
77
* @version 1.5.4
8-
* @date Thu Jul 26 2018 08:57:20 GMT+0100 (BST)
8+
* @date Thu Jul 26 2018 17:35:35 GMT+0100 (BST)
99
*
1010
* @license MIT
1111
* The MIT License
@@ -6054,13 +6054,13 @@ var Utils = function (_UtilsCore) {
60546054
var GPU = require('../index');
60556055
var x = new GPU({
60566056
mode: 'webgl-validator'
6057-
}).createKernel(function (x, y) {
6058-
return x / y;
6057+
}).createKernel(function (v1, v2) {
6058+
return v1[this.thread.x] / v2[this.thread.x];
60596059
}, {
60606060
output: [1]
6061-
})(6, 3);
6061+
})([6, 6030401], [3, 3991]);
60626062

6063-
_hasIntegerDivisionAccuracyBug = x[0] !== 2;
6063+
_hasIntegerDivisionAccuracyBug = x[0] !== 2 || x[1] !== 1511;
60646064

60656065
return _hasIntegerDivisionAccuracyBug;
60666066
}

bin/gpu.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/core/utils.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -446,13 +446,15 @@ var Utils = function (_UtilsCore) {
446446
var GPU = require('../index');
447447
var x = new GPU({
448448
mode: 'webgl-validator'
449-
}).createKernel(function (x, y) {
450-
return x / y;
449+
}).createKernel(function (v1, v2) {
450+
return v1[this.thread.x] / v2[this.thread.x];
451451
}, {
452452
output: [1]
453-
})(6, 3);
453+
})([6, 6030401], [3, 3991]);
454454

455-
_hasIntegerDivisionAccuracyBug = x[0] !== 2;
455+
// have we not got whole numbers for 6/3 or 6030401/3991
456+
// add more here if others see this problem
457+
_hasIntegerDivisionAccuracyBug = x[0] !== 2 || x[1] !== 1511;
456458

457459
return _hasIntegerDivisionAccuracyBug;
458460
}

src/core/utils.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,13 +390,15 @@ class Utils extends UtilsCore {
390390
const GPU = require('../index');
391391
const x = new GPU({
392392
mode: 'webgl-validator'
393-
}).createKernel(function(x, y) {
394-
return x / y;
393+
}).createKernel(function(v1, v2) {
394+
return v1[this.thread.x] / v2[this.thread.x];
395395
}, {
396396
output: [1]
397-
})(6, 3);
397+
})([6, 6030401], [3, 3991]);
398398

399-
_hasIntegerDivisionAccuracyBug = x[0] !== 2;
399+
// have we not got whole numbers for 6/3 or 6030401/3991
400+
// add more here if others see this problem
401+
_hasIntegerDivisionAccuracyBug = (x[0] !== 2 || x[1] !== 1511);
400402

401403
return _hasIntegerDivisionAccuracyBug;
402404
}

0 commit comments

Comments
 (0)